Skip to content

The macOS terminal, survived

This is the page you read when a command has just failed and you are already annoyed. So it is calm and specific, and it assumes nothing. The terminal is a text box that runs programs. That is the whole trick. It looks austere because it is old, not because it is judging you.

Opening it

Press Command and Space to open Spotlight, type Terminal, and press Enter. If you prefer clicking, it lives in Applications, then Utilities, then Terminal. A window opens with a blinking cursor. That cursor is waiting for you, indefinitely, without complaint.

Where am I, what is here, how do I move

Three commands cover almost everything. This block is safe to run; none of it changes a single file.

Print where you are, list what is here, then move around.

Terminal
pwdlscd ~/Desktopcd ..cd ~

pwd prints the current folder. ls lists what is in it. cd foldername goes into a folder, cd .. goes up one level, and cd ~ goes home. The ~ is shorthand for your home folder, which saves a lot of typing.

Copy and paste

Command and C to copy, Command and V to paste, exactly as everywhere else on the Mac. Every command block in this course has a Copy button in its corner, so you never have to retype one and never have to wonder whether that was a lowercase L or a one.

It printed nothing

Why

On a Mac, a great many successful commands say nothing at all. No output is usually success, not a fault. The terminal only speaks up when it has something to report, which is often an error. Silence means it did the thing and is waiting for the next instruction.

The password you cannot see

Piping a script from the internet, with caution

Some tools install by downloading a script and running it straight away, a pattern called curl into bash. It is convenient and, from a source you trust, fine. From a source you do not, it is a stranger you have handed the keys. Only run those commands from official sites, like the ones linked in this course.

Two tools that spare you the terminal

You do not have to live in here. For most of this course you can use apps with buttons. GitHub Desktop (opens in a new tab) handles git with a friendly window instead of commands, and the Postman app handles API testing without a shell in sight. Use them without guilt. For what Git actually is, and how it differs from GitHub, see Git 101.

When you are ready for more

Two tools worth knowing about later, not now. nvm (opens in a new tab), the Node version manager, lets you switch between Node versions per project. Run the install command shown in its README, because that command includes the current version and the one you half remember will be out of date. Then install the long term support release.

Only after nvm is installed. The install command itself belongs in nvm's README.

Terminal
nvm install --lts

And Homebrew (opens in a new tab) installs command line tools for you. Copy its install command from the homepage rather than from memory, for the same reason: the official one is the one that is current.