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

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org



















Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap