Apple - Mac Finder: Getting the path of a directory or file as as string

Ctrl-click (or two finger click) on the file you want the path from, then press Opt and select "Copy as path name" (or what it's called in english) from the context menu.

You can also just select the file and then press Opt-Cmd-C to copy the pathname to the clipboard.


I don't see a way to do it with just Finder. The best I could do is:

  1. Open a Terminal window.
  2. Drag the file you want into terminal.
  3. Select the filename in the terminal window.
  4. Copy the filename to the clipboard.

Safari will also work. It's a file URL, so you will have to be careful with your selection.


I'm using macOS Mojave. It's easy to find what you want, just go to folder and click on gear icon on top of window, there you can see option called "Copy 'folderName' as Pathname" That is it!

Tags:

Macos

Finder

Mac