Hey,
I have an Emacs script where the first line looks like this:
#!/usr/bin/emacs --script
However, on Mac OSX, Emacs is installed by default, but with an old version.
I have also installed Emacs via Homebrew (compiled from source) and can run that with:
/Usr/local/Cellar/emacs/23.2/Emacs.app/Contents/MacOS/Emacs
So, to run the script with the Homebrew version, I could change the first line in my script to:
#!/Usr/local/Cellar/emacs/23.2/Emacs.app/Contents/MacOS/Emacs --script
That works, but I want this script to work on both GNU/Linux and Mac OSX (Both default and Homebrew version).
I was thinking I could use env somehow, like this:
#!/usr/bin/env emacs --script
And then make emacs an alias or function that points to the correct binary depending on system. But it's still the default Emacs that is used.
Any ideas how I could solve this?