2

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.

2 Answers2

1

You probably need to source your .bash_profile:

source ~/.bash_profile

No changes made in your profile will be applied unless you source the profile or log out and back in.

Aside from that every looks like it should work.

However you may want to consider just using an alias instead of a script for this. This can be done by adding this to your profile:

alias emacs=/Applications/Emacs.app/Contents/MacOS/Emacs

That's probably a cleaner way to get the functionality you want without adding more to your PATH variable.

I hope that helps! [insert obligatory comment about how you should be using vim and not emacs :P]

CRThaze
  • 544
  • 3
  • 16
1

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

tripleee
  • 175,061
  • 34
  • 275
  • 318