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.


2 Answers 2


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.

  • my old iMac running high sierra has nano version 3.0. I didn't load this.
    – Natsfan
    Aug 18, 2019 at 17:36
  • 1
    By default, this will not compile on macOS unless one installs either Command Line Developer Tools for Xcode or Xcode. You also need to use: sudo make install Aug 18, 2019 at 23:24
  • @jmh, macOS High Sierra and macOS Mojave both ship with GNU nano 2.0.6 in /usr/bin/. You or someone else installed GNU nano 3.0. Aug 18, 2019 at 23:42
  • 2
    @user3439894 You need to use sudo to install it depending on what --prefix you used. Don't just tell people to blindly use sudo, tell them why they might need to use it. Aug 22, 2019 at 3:45

Best bet here is to use Homebrew to install the latest version.

brew install nano

This will install nano to /usr/local/bin/nano.

Next you will need to modify your .zshrc or .bash_profile (depending on what your shell is) to make sure you use this rather than the native variant. Add the line:

alias nano="$(brew --prefix)/bin/nano"

(Restart your Terminal app for this to take effect.)

  • 3
    The question explicitly says in the title "without using the homebrew package manager?"
    – mmmmmm
    Aug 3, 2021 at 7:59
  • RE: "Also the hint of alias nano is helpful." -- As, by default, /usr/local/bin/ is at the start of the PATH/path passed to the shell (at least on Intel based Macs) there is no need to alias nano, as simply typing nano and pressing enter will run /usr/local/bin/nano before /usr/bin/nano as the later is after the former in the PATH/path. Oct 26, 2021 at 22:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .