In MacOS, we get the file path by right click on a file/folder and click on get info, then copy the path.
Problem –
With the MacOS Mojave update, when we copy the file path, it comes as shown below
Which id difficult to use with coding or terminal commands.
Solution –
- Right click on the file and key press “option” key
- You will get a context menu option as “copy <FileName> as pathname” and click on it
- Above step will copy the file path into clipboard [/Users/MyMac/Documents/Myfile]
- Use command + v to use it
Hope this helps!