Installing GNU Emacs

I choose to install GNU Emacs using Homebrew.

The El Capitan (10.11.2) OS X version has Emacs 22 builtin but I wanted some GUI integration.

At the command line I ran this command:

brew install emacs --HEAD --use-git-head --cocoa --srgb

I let if finish and then to integrate a nice icon to start Emacs from the applications menu I ran this command:

brew linkapps

I wanted to be able to easily run both Emacs 22 and Emacs 25 from the command line in addition to the GUI GNU Emacs 25.

Check if their is a .bash profile.

In the Terminal enter:

ls -al ~

If no .bash_profile and .bashrc the do the following to create them.

In the Terminal and enter:

touch ~/.bash_profile
touch ~/.bashrc

To edit the file(s) use:

nano ~/.bash_profile
nano ~/.bashrc

To the .bashrc add:  [ -r ~/.bash_profile ] && source ~/.bash_profile

To the  .bash_profile add:

alias emacs25="/Applications/Emacs.app/Contents/MacOS/Emacs -nw"
alias emacs22="/usr/bin/emacs"

These alias allow me to run emacs in the terminal for either version. in the terminal by adding the version number to the end of emacs (’emacs22′ or ’emacs25′). To get the GUI version don’t add the version number ’emacs’.

To immediately enable any changes in the file .bash_profile use source:

source ~/.bash_profile