macosterminalnano

nano settings are not adopted from nanorc file


I have a new Macbook M1 and usually edit files and write short scripts with nano. However, I am stuck in default settings, which are of course not really feasible. I created a file ~/.nanorc and since it didn't work also a file ~/etc/nanorc with the following content:

set linenumbers
set tabsize 4
set tabstospaces
unset mouse

Unfortunately, it has no effect. I don't remember, if I faced the same problem when customising nano at my old macbook. Can someone help me out here?

Thanks!!


Solution

  • I was having the same issue after I installed nano using brew (Monterey on M1). It turned out that nano command is by default symlinked to pico editor in /usr/bin, see https://ss64.com/osx/pico.html.

    You can try checking if that is the case for you by using which nano. In my case it was pointing to /usr/bin/nano which is actually just symlink to pico (you can check this with readlink /usr/bin/nano)

    This is probably an issue with homebrew, check this post Homebrew: Could not symlink, /usr/local/bin is not writable

    As a quick fix (to verify if this is actually the case) you can just create a symlink pointing to homebrew installation of nano: ln -s /opt/homebrew/bin/nano /usr/local/bin/nano.
    This should open nano instead of pico when using nano command and settings in .nanorc should now also be taken into account.