Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In the terminal, I can use readlink on a symlink and it prints the target path of the symlink. E.g.

ln -s original.txt symlink.txt
readlink symlink.txt  # prints original.txt

How do I do this for Mac alias? I know the path is embedded in the resource fork, because the xattr command will display it in a raw format mixed with other data:

xattr -p -l alias_file

However, I don't know enough about this format to extract it. I found the perl Mac::Files man page, but it has no examples, and Google was no help with it.

Maybe there's a way to use osascript to do it, similar to this answer?

share|improve this question
up vote 1 down vote accepted

After more googling, I was able to pull together the pieces for an osascript command:

osascript -e 'tell application "Finder"' -e "posix path of (original item of alias file (posix file \"$alias_path\") as text)" -e 'end tell'
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.