Search code examples
emacspathbashstartupscript

Script in PATH Mac OSX terminal not working


I have the following script in my /path/to/startupscripts directory, so I can open the emacs GUI with the command 'emacs':

#!/bin/sh
/Applications/Emacs.app/Contents/MacOS/Emacs "$@"

I edited my ~/.bash_profile and added the following line

export PATH=/path/to/startupscripts/emacs:$PATH

However, the script is not working because when I type in 'emacs' into the command line emacs still opens within terminal and not the GUI like I want. Also, when I am in the /path/to/startupscripts directory and I can execute and run the script with

chmod +x emacs
./emacs

but even when I type 'emacs' afterwards it still opens within terminal. I am a bit of a beginner, and I think I am missing something painfully obvious.


Solution

  • The PATH should contain a directory name where your script(s) can be found, not the name of your individual script.