How to upgrade to the new Nano 5.0 on Mac and Pi

The Nano command line text editor has reached a new milestone: version 5.0.

There are the usual array of bug fixes and tweaks, but what caught my eye among the release notes was the introduction of a scroll indicator. This tells you where you are within a long file and is particularly good for mouse users so you can see where you’ve got to as you mouse-wheel through a document.

Nano 5.0 features a new scroll indicator on the right

As I’ve noted previously, adding set mouse to your .nanorc file, you can click at a location and the cursor will be placed there. It saves a lot of paging and cursor key clickage.

You enable the scroll indicator by adding set indicator to your .nanorc file (or adding the --indicator option when you call nano, if you just want to try it out).

Mac Installation

You can install Nano on a Mac using Homebrew:

brew install nano

You’ll also need to add the following line to your .zshrc or .bash_profile to make sure you use this rather than the preinstalled, old version:

alias nano='/usr/local/bin/nano'

Raspberry Pi

Unfortunately, the version of Nano available to Raspberry Pi users through the apt package manager is version 3.2, so here’s how to install 5.0.

Note You will first need to install wget if you don’t have it already: sudo apt install wget. You may also need to install libncurses5-dev.

The following commands are for version 5.0 — just change the version numbers for later releases:

tar -xvf nano-5.0.tar.xz
cd nano-5.0
./configure --disable-libmagic --enable-utf8
sudo make
sudo make install

If you already had Nano installed, either run sudo apt remove nano to excise it, or add the alias shown above to your .zshrc or .bash_profile if you want to keep both versions, but be sure you’re using the new one. That done, you can clean up with:

cd $HOME ; rm *.xz ; rm -rf nano-5.0

Regarding colouring Nano, as described in my last Nano post, version 5.0 allows you to prefix colour names with bold and/or italic (in that order) to apply the named style. The old style bright (basically bold plus a brighter colour intensity) has been renamed light. This style applies to the standard base colours — red, green, blue etc. — but Nano 5.0 also includes nine extra presets on terminals that support at least 256 colours for those of you who prefer a more pastel look: pink, purple, mauve, lagoon, mint, lime, peach, orange and latte.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s