Skip to content

Instantly share code, notes, and snippets.

@magnetikonline
Last active August 14, 2026 02:49
Show Gist options
  • Select an option

  • Save magnetikonline/9c83bc5dbf23049ca707426e5f71c7fd to your computer and use it in GitHub Desktop.

Select an option

Save magnetikonline/9c83bc5dbf23049ca707426e5f71c7fd to your computer and use it in GitHub Desktop.
include "/usr/local/share/nano/*.nanorc"
set tabsize 2
bind M-f nextword main
bind M-b prevword main

Install Nano on macOS from source

Requires as a minimum Xcode CLI tools (no need for a full install). Can be installed via the following:

$ xcode-select --install

Also provided an example .nanorc, which will enable color coding of common source files (include directive).

Enjoy!

Reference

#!/bin/bash -e
VERSION="9.2"
WORK_DIR=$(mktemp -d)
sudo --validate
curl --fail --silent "https://www.nano-editor.org/dist/v${VERSION%.*}/nano-$VERSION.tar.gz" |
tar --directory "$WORK_DIR" --extract --gzip
pushd "$WORK_DIR/nano-$VERSION"
./configure --prefix /usr/local
make
sudo make install
popd
nano --version
# cleanup
rm -fr "$WORK_DIR"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment