I find running the following is different from just running emacs
on mac
/Applications/Emacs.app/Contents/MacOS/Emacs -nw
Should I create an alias in zsh/bash for it?
I find running the following is different from just running emacs
on mac
/Applications/Emacs.app/Contents/MacOS/Emacs -nw
Should I create an alias in zsh/bash for it?
Just to expand on @ghoetker's answer:
~/.zshrc
in your favorite text editor.alias emacs='$(/Applications/Emacs.app/Contents/MacOS/Emacs "$@")'
source ~/.zshrc
From now on, typing emacs
will open up Emacs in the Finder.
Edit: to cover some questions that have come up, the link in this answer is only one source for Emacs, and there are dozens of others. Anywhere you download it from you will need to take the proper precautions to make sure it's being downloaded from a safe source. How exactly to do that is beyond the scope of this question but if anyone has a particular problem please post it and I'll do what I can to help.
Yes. An alias to the binary within Emacs.app is useful and will allow to call an up-to-date version of emacs from the terminal via “emacs”. I have the following set up
alias emacs='$(/Applications/Emacs.app/Contents/MacOS/Emacs "$@")'
Applying Dave Kanter's recipe, I still run into trouble: "Emacs" can't be opened because Apple cannot check it for malicious software.
To get it to run, I had to open Settings, Settings, Security & Privacy, General tab and there give Emacs permission to open anyway, at my own risk.
Now I can run Emacs from the command line, albeit without options or arguments (no file name, no -nw
option...).
I initially used:
alias emacs='$(/Applications/Emacs.app/Contents/MacOS/Emacs "$@")'
allowing me to open Emacs from terminal but not in it even if I used emacs -nw
After finding I couldn't open Emacs to run in terminal, I replaced the original alias in my .zshrc with:
alias emacs='$(/Applications/Emacs.app/Contents/MacOS/Emacs -nw)'
Now, if I want the gui version I open Emacs using spotlight. If I want the terminal version, I type "emacs" in terminal providing the best of both worlds. With the original line using "$@" I couldn't get Emacs to run in terminal even using "emacs -nw"