How to open different emacs version from the shell?
Solution 1:
To do this for just Emacs, use
alias emacs=/usr/local/bin/emacs
in your shell startup file which will make Emacs always run Homebrew emacs instead of whatever is first in your $PATH
.
But the better way to do this is to make your shell always look for Homebrew versions of commands first, by putting /usr/local/bin
first, or at least early, in your $PATH
.
So if your $PATH
is set like this:
export PATH="$PATH:/usr/local/bin"
change it to this:
export PATH="/usr/local/bin:$PATH"
/usr/local/bin
is a directory containing symlinks to all Homebrew-installed commands, Emacs included, and your shell starts at the beginning of the $PATH
to figure out what executable to use, so putting it first will in effect choose the Homebrew emacs first.
One last thing - please remove /usr/local/Cellar/emacs/24.4/bin
from your $PATH
. It's going to break when the next version of Emacs comes out. If you use /usr/local/bin
instead, Homebrew will automatically manage the symlinks when you update things.