Mac Terminal · Command Line Guide

There is no AI here. All content is human-authored and tested for accuracy.

Mac Text Editors

Text editors for the Mac.

You can edit plain text files using any text editor, including the Mac's built-in TextEdit. Don't use a word processor like Microsoft Word because it will introduce hidden formatting codes that are not suitable for plain text files.

You can also use command line programs to edit shell configuration files. Common editors include nano, vim, and emacs. Nano is simple and intuitive for beginners. Vim is operated almost entirely through the keyboard, eliminating the need for a mouse. This can lead to a more efficient editing process once you're familiar with the keybindings. Emacs is the most advanced and powerful text editor, with a long history and a dedicated community. Vim and Emacs have steeper learning curves than Nano, so start with Nano if you want to try a CLI editor.

It's best to start with a graphical text editor if you're new to programming. If you haven't used Nano or Vim before, just use TextEdit.

Edit a file

You can open a file in TextEdit from the Mac Terminal:

$ open -e ~/.zprofile

Quit the command line editor

If you are using the command line editors nano or vim to edit a file, you may get stuck when you want to quit.

For Nano, use ctrl-X to quit.

For Vim, use :q to quit.

Continue setting up your Mac

Don't miss the full visual roadmap and checklist that shows how to set up a Mac for software development, with all the essential tools and settings you might not yet know about.