You probably already know nano, the simple and easy terminal text editor. It comes pre-installed on OS X. However, the version of nano that comes pre-installed with OS X is rather old.
As of July 21st, 2017 this guide is deprecated.
You can easily install the newest version of nano on OS X using HomeBrew. Just note, since nano is in the “dupes” repository, you have to run this command, before you can install nano:
brew tap homebrew/dupes
Then install nano using this command:
brew install nano
Now you have the new version of nano installed in /usr/local/bin.
To verify path:
which nano
Output:
/usr/local/bin/nano
Verify version:
nano --version
Output:
GNU nano, version 2.4.0
Next, you have to make sure your PATH, or the global path definition in /etc/paths, has /usr/local/bin before /usr/bin (where the old version of nano resides).
Vim
Vim is an almost compatible version of the UNIX editor Vi, this editor is very useful for editing programs and other plain text files. Let’s keep it updated with Homebrew:
brew install vim --override-system-vi
Make sure your path has:
/usr/local/bin:/usr/bin
To view your path you can:
echo $PATH
To verify path:
which vim
Output:
/usr/local/bin/vim
Verify version:
vim --version
Output:
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Mar 25 2015 15:48:56)
Emacs
OS X comes with a preinstalled version of Emacs, but alas it is the outdated Emacs 22. Fortunately, obtaining a newer release is really simple:
brew install emacs --with-cocoa
After installation is complete, type:
ln -s /usr/local/Cellar/emacs/24.4/Emacs.app /Applications
Or:
cp -r /usr/local/Cellar/emacs/24.4/Emacs.app /Applications/
The second step is optional, but it’s recommended if you like to start Emacs from the launchpad or from Spotlight.
Chances are good you have an older version of Emacs installed by default with OS X. It’s suggested you to remove that older Emacs version to avoid conflicts with the new one. Do this: (I don’t recommend this!)
sudo rm /usr/bin/emacs
sudo rm -rf /usr/share/emacs
Or just create an alias in your shell and when you invoke ’emacs’ it will run the newly installed version: (My preferred method!)
alias emacs="/usr/local/Cellar/emacs/24.4/Emacs.app/Contents/MacOS/Emacs -nw"
To make it permanent, if using bash, add that line to ~/.bash_profile.
You’re now part of the wonderful esoteric world of the developers that actually know how to keep their editors up to date.