Where Is the nano Config File?
nano system and user config files: /etc/nanorc versus ~/.nanorc, and which one wins.
Last updated
nano reads two config files in order: the system wide /etc/nanorc first, then your personal ~/.nanorc on top. Every option ships commented out with documentation inline, so the files read as their own manual.
The split decides your editing strategy. System defaults suit managed machines where one config serves everyone, while a home directory copy is the right place for personal tweaks. Because the user file wins silently, a forgotten ~/.nanorc explains most my setting does nothing mysteries.
Where nano stores this, by platform
~/.nanorc
Uncomment options by removing the leading hash. Key bindings use the bind keyword with readable key names. A minimal ~/.nanorc with two or three lines beats copying the whole system file.
~/.nanorc
Same two file layout as Linux, read in the same order. Homebrew installs respect both paths, so the stock macOS nano and the brewed one share your ~/.nanorc without extra setup.
Frequently asked questions
how do i change nano settings without sudo
Edit ~/.nanorc in your home directory. It overrides /etc/nanorc, needs no sudo, and survives package updates that can replace the system file. Copy lines you want to change out of the system file as a starting template.
how do i show line numbers in nano
Uncomment the set linenumbers line in your nanorc. The system file documents every option commented out, so enabling anything is a matter of removing one hash character and saving.
Notice an outdated path? Let us know.