This should get you up and running with the installation and basic configuration of GNU Nano on both macOS and Windows. In the case of macOS, this will install a newer version of Nano that includes syntax highlighting.
It is assumed you already have Homebrew installed. If not, then Verify or Install Apple's Command-line Tools and then proceed with the installation of Homebrew. πΊ
Just a straightforward brew install nano
- Execute:
cd ~;nano .nanorc
- Add this line:
include "/opt/homebrew/Cellar/nano/*/share/nano/*.nanorc"
- Type β-o (control-o) and hit β (enter or return) to save the file.
- Type β-x (control-x) to exit.
It is recommended that you install Git with BASH as that turns out to be the most straightforward way to install the syntax highlighting.
Although Chocolately is pretty nifty, I've found its installation of Nano on Windows a bit problematic. WinGet (built into newer Windows versions) is still pretty handy so I'm recommending this path for installation.
-
Run
PowerShell
-
Run
Get-ExecutionPolicy
; if it returns Restricted, then execute:Set-ExecutionPolicy AllSigned
-
Install Git if it's not already:
winget install -e --id Git.Git
-
Update either your user or the system
PATH
and add the following (reference):C:\Program Files\Git\usr\bin
In a PowerShell prompt:
-
cd ~;nano .nanorc
-
Add these lines (Git's BASH must be installed!):
include "/c/Program Files/Git/usr/share/nano/*.nanorc" include "/c/Program Files/Git/usr/share/nano/extra/*.nanorc"
-
Type
β-o
(control-o) and hit β (enter or return) to save the file. -
Type
β-x
(control-x) to exit.
Note: You may wish to add other options, as described in this document. Alternately, you could look at the official example .nanorc
file.
D:\Git
), then you will need to update the Git Bash installation paths in "Enable Syntax Highlighting", Step 2./mnt
prefix to the installation path, as these paths are for Windows (DOS-compliant paths).nanorc
compilation repository for all your Nano syntax highlighting needs. https://github.com/galenguyer/nano-syntax-highlighting