Chapter 1aBeginner9 min read

Your First Hour in the Mac Terminal (and Claude Code)

Your First Hour in the Mac Terminal (and Claude Code)

Part of the series: Claude Code: From Zero to Swarm

What is a terminal?

A terminal is a way to talk to your computer by typing. You type a short command, press Enter, and the computer responds with text. That is the entire concept. No windows to drag, no buttons to click. Just a conversation.

Think of it as texting your computer. You send a message, it replies. Sometimes the reply is a list of files. Sometimes it is a confirmation that something happened. Sometimes it is an error message telling you it did not understand. That is fine. Error messages are not scary. They are the computer saying "I didn't get that, try again."

You cannot break your computer by typing the wrong thing in a terminal. The worst that happens is you see an error and nothing changes. The terminal is not a bomb with a hair trigger. It is a text box.

So why bother learning this? Because the most powerful AI tools available right now live in the terminal. Claude Code, the tool you are going to install today, runs here. Learning to use a terminal is the door that opens everything else.

Opening Terminal on Mac

There are two ways to open the Terminal app on your Mac.

The fast way: Press Cmd + Space to open Spotlight search. Type Terminal. Press Enter.

The other way: Open Finder, go to Applications, then Utilities, and double-click Terminal.

Either way, you will see a window appear. It will have a white or black background, some text at the top showing your username and your computer's name, and a blinking cursor waiting for you to type something. It might look like this:

yourname@MacBook-Pro ~ %

That is the prompt. It is telling you where you are and waiting for instructions. That blinking cursor is your starting point.

You might hear people mention iTerm2 as an alternative terminal app. It exists, it is popular with developers, and you absolutely do not need it. The built-in Terminal app that came with your Mac is all you need. Do not install anything else right now.

Your first commands

Let's start typing. Your first question for the computer: where am I?

Type this and press Enter:

pwd

You will see something like:

/Users/yourname

That is your home folder. pwd stands for "print working directory," which is a fancy way of saying "show me which folder I am currently in." Every time you feel lost, type pwd and the terminal will tell you where you are.

Now let's see what is in this folder. Type:

ls

You will see a list of familiar names:

Desktop    Documents    Downloads    Movies    Music    Pictures    Public

Those are the same folders you see in Finder. The terminal is looking at the same files. There is nothing hidden or special happening. It is just a different way to see the same stuff.

Let's move into one of those folders. Type:

cd Desktop

Nothing dramatic happens. The terminal does not congratulate you. But you have moved. Confirm it by typing pwd again:

pwd
/Users/yourname/Desktop

You are now standing inside your Desktop folder. If you type ls here, you will see whatever files and folders are sitting on your Desktop right now.

Now let's create something. Type:

mkdir my-first-project

You just created a new folder called my-first-project on your Desktop. If you look at your actual Desktop, you will see it there. mkdir means "make directory" — directory is just the old word for folder.

Let's go inside it:

cd my-first-project

And check what is in there:

ls

Nothing. The terminal shows you an empty line or returns silently to the prompt. That is expected. You just created this folder, so it is empty. You are standing inside an empty room you built yourself.

The mental model

Here is how to think about what just happened. You are always "standing" in a folder. Every command you type runs from that location. When you type ls, it lists what is in the folder you are standing in. When you type cd, you walk into a different folder.

Commands are like short sentences. They have a verb (the command) and sometimes a target (what you want the command to act on). cd Desktop means "go to Desktop." mkdir my-project means "create a folder called my-project."

Here are the commands you have learned so far:

CommandWhat it doesExample
pwdShows where you are/Users/you/Desktop
lsLists what's in the folderDocuments Downloads Desktop
cdMoves to a foldercd Desktop
cd ..Goes back one levelGoes up to parent folder
mkdirCreates a new foldermkdir my-project

Two tricks that will save you time. First: Tab completion. Start typing the name of a folder and press the Tab key. The terminal will fill in the rest for you. If you type cd Desk and press Tab, it will complete to cd Desktop. This works everywhere and prevents typos.

Second: the up arrow key. Press it and your previous command appears. Press it again and the one before that appears. This is useful when you want to repeat something you just did or fix a small mistake in the last command you typed.

One more: cd .. takes you back one level. If you are inside my-first-project and type cd .., you will be back on the Desktop. The two dots always mean "the folder above this one."

Installing Node.js

Before you can install Claude Code, you need Node.js on your computer. Think of Node.js as the engine that Claude Code runs on. The way a car needs an engine to move, Claude Code needs Node.js to work.

You have two options. Pick whichever feels more comfortable.

Option A: The download way (easiest)

Open your web browser and go to nodejs.org. You will see a big green button that says "LTS" with a version number. LTS stands for Long Term Support, which means it is the stable, reliable version. Click it. A .pkg file will download. Open it and click through the installer steps. It is a standard Mac installer — click Continue a few times, agree to the license, and click Install. Done.

Option B: The terminal way

If you want to do everything from the terminal, you can install Homebrew first. Homebrew is a package manager for Mac — think of it as an app store that runs in the terminal. Paste this command and press Enter:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

This will take a minute or two. It may ask for your Mac password. When you type your password in the terminal, you will not see any characters appear on screen. That is normal. It is still registering your keystrokes. Just type your password and press Enter.

Once Homebrew is installed, install Node.js with:

brew install node

Verify it worked

Regardless of which option you chose, let's confirm Node.js is installed. Type:

node --version

You should see something like:

v22.14.0

The exact number does not matter. If you see a version number, it worked. If you see "command not found," something went wrong with the installation. Close the terminal, open it again, and try the command once more. Sometimes the terminal needs a fresh start to recognize newly installed software.

Installing Claude Code

Now for the main event. Type this single command:

npm install -g @anthropic-ai/claude-code

npm is a tool that came bundled with Node.js. Think of it as an app store for command-line tools. The -g flag means "install globally," which means you will be able to use Claude Code from any folder on your computer, not just the one you are currently in.

The installation will take a moment. You will see some text scrolling by as it downloads and sets up the package. When it finishes and you see your prompt again, verify the installation:

claude --version

You should see a version number. That means Claude Code is installed and ready to go.

One thing you will need before using Claude Code: an Anthropic account. If you do not already have one, go to console.anthropic.com and create an account. The first time you run Claude Code, it will walk you through connecting your account.

Your first conversation with Claude Code

Let's go back to the project folder you created earlier. If you are not already there:

cd ~/Desktop/my-first-project

The ~ is a shortcut that always means your home folder. So ~/Desktop will work no matter where you currently are in the terminal.

Now type:

claude

Press Enter. Claude Code starts up. You will see a welcome message and a prompt that looks different from the regular terminal prompt. This is Claude's prompt. You are now inside a conversation with an AI that can see and interact with the files on your computer.

Try typing this:

What files are in this folder?

Claude will look at the folder and tell you it is empty. That is correct. You created this folder and have not put anything in it yet.

Now try something more interesting. Type:

Create a simple HTML page that says Hello World

This is the moment where it clicks. Claude will think for a moment, then propose creating a file. You will see it describe what it wants to do and the content of the file it wants to create. It will ask for your permission before doing anything.

You will see something like:

Create file: index.html
Allow? (y/n)

Press y and Enter. Claude creates the file. It now exists on your computer, in the my-first-project folder on your Desktop. You could open it in a web browser right now and see "Hello World" on the page.

After it creates the file, try asking:

Show me what's in the file you just created

Claude will display the contents of the file and explain what each part does. You are having a conversation about code, and the AI is doing the actual work of creating it.

Understanding the basics

Now that you have had your first conversation, here are a few things worth understanding about how Claude Code works.

How Claude sees your files. When you start Claude Code inside a folder, it can read everything in that folder and its subfolders. It is like giving someone access to a filing cabinet. If you start it in your my-first-project folder, it can see everything in there. It cannot see files outside that folder unless you specifically navigate there. This is why it matters which folder you are in when you type claude.

The permission system. Claude always asks before it changes anything. Creating a file, editing a file, running a command — every action that modifies something on your computer requires your approval. You press y to allow it or n to deny it. You are always in control. Claude proposes, you decide.

Getting help. If you are inside Claude Code and want to see what commands are available, type:

/help

This shows you a list of built-in commands and what they do. It is a good reference when you are exploring.

A practical exercise. Try this while you still have Claude Code open. Type:

Create a simple Python script that prints the current date and time

Watch it create the file. Then ask:

Now explain what each line does

Claude will walk you through the code line by line, explaining what each part means in plain language. This is one of the most powerful things about working this way. You do not need to understand the code before it gets written. You can create first and learn after.

Exiting Claude Code. When you are done, type:

/exit

Or press Ctrl + C. You will return to the regular terminal prompt. Your files are still there. Claude Code is just a tool you step into and out of. Everything it created persists on your computer after you leave.

What you just learned

You opened a terminal for the first time. You learned to navigate folders, check where you are, and create new directories. You installed software using terminal commands. And you had a conversation with an AI that can read and write files on your computer.

That is all it takes to be someone who uses a terminal. There is no certification, no threshold of expertise you need to cross. You typed commands, they worked, and you built something. You are already on the other side.

The skills you practiced today — navigating folders, installing tools, running commands — are the same skills you will use every time you work with Claude Code. They do not change. They just become automatic with repetition.

Next in the series, you will learn how to work with Claude Code on real projects: giving it context about what you are building, working with existing files, and turning ideas into working software through conversation.