Is there a keyboard shortcut for toggling line number display in the nano editor on a Mac? The keyboard shortcutOption-# that works in Linux work doesn't work on a Mac. I read where someone suggested Control-# or Control-C but they don't work either.

I realize it can be set in the nanorc configuration file, but I only want to see line numbers when I need them, like when I need to see which line an error is occurring on, hence the desire to toggle the display.

1 Answer 1


escn and escshift# work on macOS.

Meta-key sequences are notated with 'M-' and can be entered using either the Alt, Cmd, or Esc key, depending on your keyboard setup.

  • esc-n works. Thanks! Aug 16, 2022 at 15:45
  • I have on #macos "GNU nano version 2.0.6 (compiled 02:20:53, Aug 29 2022)" and not work even with command line arg nano: unrecognized option '--linenumbers'
    – Bruno
    Nov 9, 2022 at 1:51
  • Make sure you have the brew version of nano first in your path. The current version of GNU nano is 6.4. The one in /usr/bin/nano is a symlink to pico. Apple silicon macs have a slightly different install path for brew. which -a nano /usr/local/bin/nano /usr/bin/nano /usr/local/bin/nano --version GNU nano, version 6.4 /usr/bin/nano@ -> pico Nov 10, 2022 at 5:03

You must log in to answer this question.

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