OS X: Get Full Path of File Using Realpath

- - posted in osx, tips

Demonstrate of realpath
1
2
3
➜  /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.

1
2
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