How do you update the default version of Nano on MacOS X without using the homebrew package manager?

I did do some research to check for installation methods but I primarily came across the homebrew method, and I didn't actually see any information about a binary download for Mac. The binary on the nano website is only for Linux.

However, I want to update the version of the nano that is bundled with my Mac, located in the /usr/bin folder. Is it safe to directly paste the Linux nano binary into the aforementioned folder?

If my lack of knowledge is showing through my summary of the information please let me know.


Solution 1:

Recent Macs ship with GNU nano version 2.0.6, which is a far cry from the latest version 4.3.

GNU nano is written in C and thus very easy to build from source. To do this, try the steps below that are reproduced from the README file that is included in the source code which you can find here:

  1. curl -O https://www.nano-editor.org/dist/v4/nano-4.3.tar.gz

  2. tar xvzf nano-4.3.tar.gz

  3. cd nano-4.3

  4. ./configure

  5. make

  6. make install

You should then have an up to date version of the binary. This does not replace the nano that ships with macOS - but it allows you to have one you can patch faster (or to a different level) than Apple updates it. You will have to make sure you add the path to the nano above to your path before /usr/bin/nano is in the $PATH

Many people like https://brew.sh since it fixes your path and then installs nano and other tools correctly so they run before the system versions.