Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save wille-io/3282397bf8f5790314a7f7d5637f45b1 to your computer and use it in GitHub Desktop.

Select an option

Save wille-io/3282397bf8f5790314a7f7d5637f45b1 to your computer and use it in GitHub Desktop.
Install nano on MacOS with syntax highlighting via homebrew

At least on MacOS Monterey you don't get the real nano when executing nano, but rather the original fork parent pico. If you want to use the real deal, you can install and replace pico. I hope you have homebrew installed.

  1. Install nano via homebrew: brew install nano
  2. Tell your Terminal to open homebrew's version of nano (works with zsh) by adding a line to your .zshrc file: echo 'alias nano="/opt/homebrew/bin/nano"' >> ~/.zshrc to the .zshrc file
  3. Reload .zshrc to have the current Terminal also have the new alias: source ~/.zshrc
  4. Tell nano to use syntax highlighting for all types of languages, etc. by writing / creating the .nanorc file: echo 'include "/opt/homebrew/share/nano/*.nanorc"' >> ~/.nanorc

All-in-one command: brew install nano && echo 'alias nano="/opt/homebrew/bin/nano"' >> ~/.zshrc && source ~/.zshrc && echo 'include "/opt/homebrew/share/nano/*.nanorc"' >> ~/.nanorc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment