# Install Claude Code

Web page: https://academy.memberpress.ai/courses/code-intro/l1/

Lesson 1 of 8 in [Claude Code — Getting Started](https://academy.memberpress.ai/courses/code-intro/), 3 min.

Video: https://www.youtube.com/watch?v=ZmPHdFrdENc

Most developers install Claude Code, open it in their largest repo, and ask it to "clean things up." The session produces a 400-line diff they can't evaluate and they close the tab. The install is not the hard part. Knowing what to look at while Claude runs is.

**Two install paths**

The CLI and the IDE extension are separate packages. The CLI is the right starting point because every tool call is visible in the terminal. You see what Claude reads, what it proposes to change, and what it executes. That visibility is what makes the first session useful rather than alarming.

```bash
npm install -g @anthropic-ai/claude-code
claude --version
# → claude-code/1.x.x darwin-arm64 node-v20.x.x
```

If `claude --version` prints nothing, your `npm` global bin directory is not on `PATH`. Run `npm bin -g` to find it, then add that path to your shell profile.

**Authenticating**

On first run, `claude` opens a browser window for Anthropic account authentication. Complete the OAuth flow, return to the terminal, and you will see a confirmation line. The token is stored in `~/.config/claude/` — you do not need to handle it manually.

```bash
claude
# → Authenticated as yourname@example.com
# → Working directory: /your/project
# → >
```

**Adding the IDE extension**

The VS Code extension wraps the same CLI binary. Install it from the Extensions panel by searching "Claude Code," sign in with the same Anthropic account, and the Claude panel appears in the sidebar. The extension adds inline diff previews and a keyboard shortcut for asking Claude about selected code. Install it after you have run one CLI session — you will have context for what the extension is showing you.

**Which to use day-to-day**

Use the CLI when you want to see every tool call in sequence. Use the extension when you are inside a file and want to ask a quick question about a function without switching windows. They share the same session state.

**If you get stuck**

- `npm install -g` fails with permissions error: do not use `sudo`. Instead, configure `npm` to use a user-writable global directory. `npm config set prefix ~/.npm-global` and add `~/.npm-global/bin` to `PATH`.
- The browser auth window does not open: run `claude auth login` explicitly. It prints a URL you can paste manually.
- `claude --version` prints an old version after reinstall: close all terminal tabs and reopen. Shell sessions cache the old binary location.

**Deliverable**

`claude --version` prints a version number in your terminal.

## Try these prompts

- Write the exact shell command to install Claude Code globally and verify the install.
- My npm global bin directory is not on PATH. Write the commands to find it and add it to my zsh profile.
- Write the Claude CLI command that explicitly opens the browser authentication flow.

## Transcript

Hi, I'm Opal. In this course, I'll teach you to work with Claude Code: you give it a job, and it reads and edits the files in your project. By the end of this first lesson, you'll have it installed, signed in, and answering in your terminal. Here's why I start so small.

Most people install Claude Code, point it at their biggest project, and ask it to clean things up. Ten minutes later they're staring at four hundred changed lines they can't judge, and they close the window for good. Installing it is the easy part. The real skill is knowing what to watch while it works, and that's what the rest of this course is about.

So today, we just get it running. You can use Claude Code two ways: in the terminal, or inside your code editor. I want you to start in the terminal. Every step Claude takes shows up there, one line at a time.

You'll see which files it opens, what it wants to change, and which commands it runs. That's exactly what you need to see in your first week. So, here's the install. Open your terminal and run the npm install command from this lesson's page.

It installs Claude Code for your whole computer. Then type claude, dash dash version. If you get a version number back, you're installed. Next, type claude on its own.

The first time, it opens your browser and asks you to sign in to your Anthropic account. Finish that, come back to the terminal, and it'll tell you who you're signed in as and which folder it's working in. That's it. You're in.

Once you've had one real session in the terminal, add the editor extension. Search for Claude Code in your editor's extensions and sign in with the same account. It's the same Claude underneath, just inside your editor. Now, the mistake I see most often.

The install fails with a permissions error, and the quick fix seems to be putting sudo in front of it. Please don't. Running the install as the administrator causes more trouble later on. Instead, point npm at a folder you own.

The exact two commands are on the lesson page. And if claude dash dash version prints nothing at all, your terminal just can't find the program yet. The lesson page shows you how to add npm's folder to your path. If it prints an old version after you reinstall, close every terminal window and open a fresh one.

Here's the one thing to take away. When claude dash dash version answers you with a number, you're ready for your first real task, and that's the next lesson.

Next: [First task — let it edit a file](https://academy.memberpress.ai/courses/code-intro/l2/)
