Setting up a new MacBook. I like to use pico, so I always remember to add

export EDITOR=nano
alias pico=nano
alias pcio=nano
alias pioc=nano

to my .profile. But I'm still missing something that I used to have, because whenever I launch nano with multiple command-line arguments, instead of opening each file in sequence, it only opens the first filename.

nano x.txt y.txt # edits x.txt and then quits!

This isn't how it behaved on my old machine. What's the fix? (Is there an environment variable to make nano open multiple files?)

1 Answer 1


macOS nowadays ships with a very old version of pico, instead of nano, by default. (pico doesn't even recognize the standard -v or --version arguments; it treats them as filenames.)

$ which nano
$ /usr/bin/nano -version
Pico 5.09
$ man /usr/share/man/man1/nano.1
       pico [ options ] [ file ]

The solution is simply to install a (much) newer version of nano. The easiest way is brew install nano. Or without Homebrew, see this question. After brew install nano, I see:

$ which nano
$ nano --version
 GNU nano, version 7.2
 (C) 2023 the Free Software Foundation and various contributors
 Compiled options: --disable-libmagic --enable-utf8
$ man nano
       nano [options] [[+line[,column]] file]...

       nano [options] [[+[crCR](/|?)string] file]...

which indicates (truthfully) that nano 7.2 supports multiple filenames on the command line. That's all it took!


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .