How to Copy File Path in macOS Finder

This week is bit hectic with everything going on in South Korea. So this one is one of the reserved pieces I was thinking to publish should I need more time to work on a post. This is a commonly known trick for seasoned Mac users, and a feature I believe should be available on most GUIs.

On my of the scripts I write for Mad Tea Party, you would have seen the phrase: replace [path] with your own. There is a trick to speed up the process. On Terminal, there is much simpler way to manage different paths. Simply drag and drop the destination folder into the terminal window, and it will copy paste the path to the folder or file you chose. This method also adds backward slash to special characters (e.g. space), but without the quotations around the string.

Another method is to use oldest trick in the book: right click (or CTRL+click) on the file or folder. When you are holding down the OPT key, “Copy” menu will change to “Copy [file name] as Pathname”. This method does not add backward slash to special characters, but it will add quotations around the string.

It’s a very simple trick. But it is a trick that will see almost daily usage, and something most people could definitely make use out of. If you are using it, or expecting your script to take advantage of it, you do need to be careful about how each method treats the path string afterward; it was a mistake I learned the hard way.

Leave a comment