How can I copy the path of a file in Finder?

Solution 1:

Right click on the file, hold down Alt/Option, and an item to copy file path will appear as Copy "<FILENAME>" as Pathname.

This is the easiest option for day to day usage, without involving Automator.

This seems to be a relatively new feature that was added in OS X El Capitan. (It also works on macOS Sierra).

Solution 2:

As already described by ayaz, the Get Info window (cmd+i) has the full path and will allow you to copy it. If you tripple click in the highlighted area (by the red rectangle) the selection will automatically expand to the whole path. cmd + c will suffice to copy it to the clipboard.

get info window

If you need the path to interact with the Terminal, you can always check one of the “zillion” answers in this Stack Overflow Question.

UPDATE: This method seems to be only valid for OS X 10.6.x, previous OS X versions used the non-POSIX path style that looked like path:to:file, whereas the POSIX would be path/to/file. If you are in something older than OS X 10.6, you will have to try one of the other methods described in the other answers (or upgrade to 10.6 ;)

Solution 3:

Starting in El Capitan (OS X v10.11), this is really easy:

  1. Select the item(s) in the Finder
  2. Press Command-Option-C (or hold the Option key down and choose Edit menu > Copy [whatever] as Pathname.

Solution 4:

There are two ways I do this (and the info window is neither of them):

  1. Open the Terminal application and drag the item into the window, and a POSIX-style path will be displayed that you can copy and paste.
  2. Use Applescript...

...select an item in the Finder and run this...

tell application "Finder"
    return info for selection as alias
end tell

...or create a droplet with this code...

on open theFile
   set thePath to POSIX path of theFile
   set the clipboard to thePath as text
end open

Add salt to taste.

Solution 5:

The best and easiest way to do this is by creating a "copy path" service, very similar to the shift + Right-Click on a Windows machine.

If you frequently need to copy and paste file and folder paths, creating an Automator Service will make your life easier because the service then becomes accessible from the OS X Right-Click contextual menu, accessible from anywhere in the Finder.

Follow these steps to set it up (screenshots below).

  1. Launch Automator
  2. Create a new “Service”
  3. Use the search function to look for “Copy to Clipboard” and drag that into the rightsize panel of the Service Set ‘Service receives selected’ to “files or folders” and ‘in’ to “Finder”.
  4. Save the Service with a name like “Copy Path”.

    enter image description here

The result:

enter image description here

You'll now have the textual path in your clipboard.

Sources: CNet, OSX Daily