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 com.apple.ResourceFork 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?

1 Answer 1


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'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .