To do this for just Emacs, use
in your shell startup file which will make Emacs always run Homebrew emacs instead of whatever is first in your
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
So if your
$PATH is set like this:
change it to this:
/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.