48

When I try to get the path of a file using ⌘ (Command)+I, it gives the path in a different way.

I see this only after updating to Yosemite. It is not a text. How do I get it in the format /Users/Myself/Documents/…?

Madusanka
  • 583

5 Answers5

45

Just select the file itself in Finder and press CmdC or go to Edit » Copy. You can then paste the path directly to a terminal window.

Note that this will escape special characters.

If you want the path in human-readable form, you need to do the following:

  • Open Utilities/Automator.app
  • Create a new Service
  • Set it to receive no input from Finder.app
  • Drag Run AppleScript from the left pane to the right
  • Paste the following into the field:

    tell application "Finder"
        set sel to the selection as text
        set the clipboard to POSIX path of sel
    end tell
    
  • It should look like this:

  • Save the service under any name you like, e.g. Copy human-readable path.

This is part one. Now, set a keyboard shortcut:

  • Head to  » System Preferences » Keyboard » Shortcuts
  • Go to the Services section and scroll down
  • Set a keyboard shortcut for your service

Et voilà, now press that shorcut when you need the path of any selected Finder item.

slhck
  • 235,242
13

Open up the “Terminal” in Applications > Utilities > Terminal and then drag the file into the window. The full Unix path of the file will show up.

Giacomo1968
  • 58,727
3

Right-click (or control-click) on the file icon, then hold down the option key. In the pop-up menu that appears there will be a "Copy "filename" as Pathname" menu item. That menu item will put the POSIX path to the item on the clipboard.

ThomasW
  • 403
1

Drag the file into textEdit to get the path.

Dragging the file into Terminal will replace spaces or special characters in the file name with backslashes.

-1

Navigate to the file. Copy the file (Cmd+C). Open TextEdit or Notes. Paste (Cmd+V).

Magic!