I’m running Snow Leopard, and trying to run Emacs such that when I start it up, the output of (getenv "PATH") is the same as the output in Terminal.app of echo $PATH.
In other words, I want to start up Emacs from /Applications/Emacs.app and have it start with my $PATH. I haven’t been able to figure out how to do this within emacs, or with how I start emacs up. So I’ve spent most of my effort trying to come up with a shell script that I can wrap with something like Platypus or Appify.
So the closest thing I have right now is:
echo MYPASSWD | sudo -S -u USERNAME -i nohup /Applications/Emacs.app/Contents/MacOS/Emacs > /dev/null &
which fails because it seems that nohup throws away my $PATH, despite the -i flag. The following does not throw away my PATH but open a superfluous Terminal.app:
echo MYPASSWD | sudo -S -u USERNAME -i open /Applications/Emacs.app/Contents/MacOS/Emacs > /dev/null &
I’ve tried running this through do shell script in an AppleScript, also to no avail.
Am I missing something basic? It doesn’t seem like this should be hard. Thanks!
I wrote a little elisp a while ago to parse the output of env and apply it to the Emacs environment because I didn’t want to maintain a plist. The code’s at http://paste.lisp.org/display/111574.