9

Is there a built-in text editor in the terminal on Lion?

(Like, for example, nano on Linux.)

6
  • 2
    umm... like vim, emacs?
    – rm -rf
    Jun 11, 2012 at 22:38
  • 3
    @Jay Did you even try running nano in the Terminal?
    – Cajunluke
    Jun 11, 2012 at 22:43
  • @CajunLuke No, for some reason I thought it wasn't there. Oh well.
    – user23741
    Jun 11, 2012 at 22:50
  • 1
    I disagree with the heavy down vote penalty you've incurred. This is an easy question to answer if you have a Mac in front of you. But if you don't have a Mac at hand or don't own one yet and are wondering what the command line experience is like this is potentially useful information. Just because something seems obvious or is well known to you doesn't mean that's the case for everyone else.
    – Ian C.
    Jun 12, 2012 at 13:41
  • When Apple stopped shipping their current OS with GNU Emacs, they replaced it with mg. Aug 4, 2021 at 1:56

5 Answers 5

16

vim, emacs, nano and pico are all available by default with OS X 10.7.4:

/Users/ian
> which nano
/usr/bin/nano

/Users/ian
> which vim
/usr/bin/vim

/Users/ian
> which emacs
/usr/bin/emacs

> which pico
/usr/bin/pico
7
  • They've been on every Mac I've ever used since the 10.2 days, and I'd be shocked if OS X had ever not included them.
    – Cajunluke
    Jun 11, 2012 at 22:42
  • 3
    And for hard core users there is even /bin/ed :-)
    – nohillside
    Jun 12, 2012 at 5:58
  • @CajunLuke: actually, nano was added in 10.4 (although pico, the editor it's based on, was in at least 10.3). I can't say for certain about emacs, but I'm pretty sure vi was there in Rhapsody Server. Jun 12, 2012 at 6:02
  • @GordonDavisson Nano was definitely around in 10.2 and 10.3. I remember using it (and I've an old 10.3 Mac I can check on if needed).
    – Cajunluke
    Jun 12, 2012 at 13:39
  • @CajunLuke: I just checked under 10.3.9 computer (server version, but that shouldn't matter) and it has pico but not nano. I don't have a 10.2 machine handy anymore... Jun 12, 2012 at 15:40
4

Since ed has not been mentioned yet, even thought I'd choose to use nano over it and the others mentioned, let me offer it as an addition to the cumulative list.

The manual page for ed states:

The ed utility is a line-oriented text editor. It is used to create, display, modify and otherwise manipulate text files.

1
  • 1
    The ed utility does not recognize multibyte characters., so it's use may be rather small nowadays.
    – nohillside
    Sep 30, 2017 at 8:56
3

Since this question is about "built-in" editors "like" nano, this question needs an updated answer:

The command pico is just a symlink to nano, vi is actually vim as is ex and not counting awk or psed, cat, xargs, constructions and the like, thats about it, since ed is indeed present but very unlike nano (depending on the definition of "editor").

Three CLI text editors (like nano) are present in the default of Sierra:

  • nano (installed: 2.0.6, current: 2.8.7. "Of course, you should always check the nano homepage to see what the latest and greatest version is.")

    GNU nano is designed to be a free replacement for the Pico text editor, part of the Pine email suite from The University of Washington. It aims to "emulate Pico as closely as possible and then include extra functionality".

  • vim (installed: Vi IMproved 7.4, current: "Vim 8.0 is the latest stable version")

    Vim is a highly configurable text editor built to make creating and changing any kind of text very efficient. It is included as "vi" with most UNIX systems and with Apple OS X.

  • emacs (installed: GNU Emacs 22.1.1, current: "Emacs 25.3 − latest release Released September 11, 2017 Emacs 25.3 fixes a significant security hole.")

    An extensible, customizable, free/libre text editor — and more.

1

In addition to ones listed above there is also xedit. It's opened from the terminal by just typing xedit. Opens an editor window where you can edit a file with keyboard and mouse.

1
  • 1
    It might be worth mentioning that xedit requires XQuartz/X11 to be installed (and that launching X11 just to edit a file might be kind of overkill).
    – nohillside
    Oct 2, 2017 at 17:58
0

Yes, nano and vim for example are installed with Mac OS X.

You must log in to answer this question.