Dereference symbolic link in OS X?

Posted by ithinkihaveacat on Server Fault See other posts from Server Fault or by ithinkihaveacat
Published on 2012-11-27T23:10:18Z Indexed on 2012/12/05 17:06 UTC
Read the original article Hit count: 218

Filed under:
|
|

In OS X, how can I dereference a symbolic link to a canonical file name? (i.e. one starting with /.)

That is, I'm after the equivalent of GNU readlink's -f option:

kapow:~$ greadlink -f .bash_profile
/Users/mjs/.config/home/.bash_profile

OS X's readlink instead returns a relative link:

kapow:~$ readlink .bash_profile
.config/home/.bash_profile

stat(1) does have an amazing number of options, but I couldn't figure out the right combination to do what I want.

© Server Fault or respective owner

Related posts about macosx

Related posts about symbolic-link