I am trying to obtain the absolute path to the currently running script on OS X.

I saw many replies going for `readlink -f $0`. However since OS X's `readlink` is the same as BSD's, it just doesn't work (it works with GNU's version).

Is there an out-of-the-box solution to this?