If you spend a lot of time in the terminal on macOS, sooner or later you’ll need a text editor. Vi is powerful, but not for everyone. Nano, on the other hand, is a lightweight, intuitive editor that’s perfect for quick edits. Unfortunately, macOS only comes with an outdated version – or worse, one missing useful features like syntax highlighting or mouse support.
The solution: compile it yourself.
Sounds like a lot of work – but it really isn’t. Especially not if you use a small script that handles most of the heavy lifting for you.
In this post, I’ll show you just such a script – it’s called makenano
, and it takes care of all the steps required to build a local, feature-rich version of Nano.
Requirements
Before you begin, you’ll need the Command Line Tools. If you don’t have them installed yet, you can do so easily by running this in Terminal.app:
xcode-select --install
Next, download the makenano
script as a zip file. It will end up in your Downloads folder and should automatically unzip itself. If it doesn’t, you’ll need to unzip it manually with a double-click.
Since scripts downloaded from the internet are marked with a quarantine flag and aren’t executable right away, you’ll need to remove that flag and make the script executable. In the terminal, run:
cd ~/Downloads
xattr -c makenano
chmod a+x makenano
Now you’re ready to run the script:
./makenano
After a short while, you’ll be prompted to enter your admin password so the installation can complete. Once that’s done, Nano will be installed and you should see a success message like:
Finished building:
GNU nano, version 8.4
(C) 2025 the Free Software Foundation and various contributors
Compiled options: --disable-libmagic --disable-nls --enable-utf8
In addition, an uninstall_nano.sh
script is created, which you can use to uninstall Nano if you ever want to remove it.
Why compile it yourself?
The Nano version available via Homebrew works, but it brings along a lot of unnecessary overhead – including extra libraries – even though all libraries needed for Nano are already included in macOS.
Goodies for Keyboard Shortcuts
Since macOS already uses many keyboard shortcuts, some of them conflict with the ones used in Nano. Unfortunately, these are precisely the ones you need for quick text navigation: Home to jump to the beginning of a line, End for the end, PageUp/PageDown for scrolling, and Option + Arrow (ALT + Cursor) to move word by word.
Luckily, there’s a simple fix for this.
For Home, End, PageUp, and PageDown:
- Open Terminal → Preferences → Profiles and select your profile on the left.
- Go to the “Keyboard” tab and check if the relevant key mappings are already there.

If so, select the entry for Home (↖︎) and click “Edit” below – otherwise, click the + button.
In the dialog that appears:
- Set “Key” to Start (this is Home),
- Set “Modifier” to None,
- Set “Action” to Send text.
Now, clear any text in the input field, and press CTRL + A
. This inserts the control character \001
. (Note: you can’t just type \001
, you have to use the actual CTRL key.)

Repeat the same for End (CTRL + E
→ \005
), PageUp/PageDown (ESC
→ \033
), then the rest as shown in the screenshot.
To enable jumping to the next/previous word with ALT + Arrow keys, you need to edit the .nanorc
file in your home directory. Open Terminal and launch the newly installed Nano:
cd ~
nano .nanorc
Add the following lines and save with the usual Nano commands (CTRL + X
followed by Y
):
include "/usr/local/share/nano/*.nanorc"
set autoindent
set tabsize 4
set tabstospaces
bind M-F nextword main
bind M-B prevword main
unbind ^_ all
bind ^_ gotoline all
These settings enable syntax highlighting, convert tabs to spaces (with a tab width of 4), auto-indent new lines, and remap the “Go to line” shortcut so it shows up correctly in the help line (CTRL + _
instead of CTRL + /
).
Enjoy Your Modern Nano
That’s it – enjoy working with an up-to-date version of Nano on macOS!