How to Copy full Absolute Path of a File on Mac


There are a few ways that I know you can copy the absolute path of a file on a Mac,

1. Using the Terminal and realpath command

Example:
% realpath key.pem 
/Users/code2care/Desktop/key.pem

As you can see the realpath command followed by the file name gives you the full absolute path of the file along with the file name and extension.

You can make use of the pwd - present working directory command if you want to know the complete path of a directory.

Copy File Absolute Path on Mac

2. Using the Mouse and Keyboard

  1. Right-Click (Doble-tap or Trackpad if on Macbook) on the file,
  2. Now as you see the Menu press Option ⌥ Key on your Mac Keyboard,
  3. Instead of Copy option you should see "Copy filename as Pathname"
  4. While holding the Option key select the Copy filename as Pathname option,
  5. The absolute path will get copied on the Clipboard
-


Have Questions? Post them here!

Topics Coverage:


🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.

Follow Us: GitHub | Facebook | Twitter | Instagram