OS X: get full path of file using realpath

less than 1 minute read

➜  /Applications  realpath iBooks.app
/Applications/iBooks.app
➜  /Applications

realpath is a command line utility that is included in most UNIX distributions but not Mac OS X. Thanks to Stuart Campbell, a minimal implementation is provided here, and my fork.

If you use homebrew, you can tap my repo, and install it using homebrew.

brew tap iveney/mocha
brew install realpath

Viola! Now you can get the full path of file in console. A nice thing I often use is to chain it with pbcopy to copy the full path to the OS X clipboard.

Comments