Skip to content

Instantly share code, notes, and snippets.

@BlakeGardner
Last active March 21, 2024 13:39
Show Gist options
  • Save BlakeGardner/5587269 to your computer and use it in GitHub Desktop.
Save BlakeGardner/5587269 to your computer and use it in GitHub Desktop.
Syntax highlighting in nano on Mac OS
# Last updated March, 2022 for Apple silicon Macs
# Install Homebrew if you don't already have it: https://brew.sh
# install nano from homebrew
brew install nano nanorc
# update your nanorc file
echo 'include "/opt/homebrew/share/nanorc/*.nanorc"' >> ~/.nanorc
# close and re-open your terminal and you'll have syntax highlighting
@s-ota-66
Copy link

Worked for me:

brew install nano nanorc
echo 'include "/opt/homebrew/share/nanorc/*.nanorc"' >> ~/.nanorc

macOS Ventura 13.2.1
Homebrew 4.0.13

@BlakeGardner
Copy link
Author

Thanks, updated the gist @s-ota-66

@benolot
Copy link

benolot commented Apr 22, 2023

Thanks all for the guide! Can confirm current version is working on 13.3.1

@ryenus
Copy link

ryenus commented May 11, 2023

Better to use $(brew --prefix) to work with both Intel & ARM chips

brew install nano nanorc
echo 'include "'"$(brew --prefix)"'/share/nanorc/*.nanorc"'

@nospam2k
Copy link

nospam2k commented Nov 24, 2023

echo 'include "/usr/local/Cellar/nano/*/share/nano/*.nanorc"' >> ~/.nanorc

Works for Sonora

@firstrecall
Copy link

firstrecall commented Nov 29, 2023

echo 'include "/usr/local/Cellar/nano/*/share/nano/*.nanorc"' >> ~/.nanorc

Probably it would be better to use

echo 'include "'"$(brew --cellar nano)"'/*/share/nano/*.nanorc"' >> ~/.nanorc

so in such case it will use the right path depends on if mac uses Intel or Apple Silicon

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