How to open different emacs version from the shell? I have two versions of emacs on my machine. One came preinstalled and I have just installed a newer version with homebrew. 



If I type emacs in the terminal, the old version runs. If I type emacs-24.4 then the new version runs. What do I have to do to ensure typing just emacs runs the 24.4 version and not the older version?
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.