All posts
Tutorials

How to install Claude Code and run your first session

25 Nov 20265 min read10 views
How to install Claude Code and run your first session

Claude Code is a coding agent that runs in your terminal. It is not an autocomplete plugin: it sees the whole project, reads and edits files, runs commands and tests, and can even commit. I have written most of my code with it for months now. This guide covers installing Claude Code, your first session, and a few habits that pay off from day one.

What you need before installing Claude Code

  • Operating system: macOS 13+, Windows 10 (1809) or later, Ubuntu 20.04+, Debian 10+ or Alpine 3.19+.
  • Hardware: at least 4 GB of RAM and an x64 or ARM64 processor.
  • Account: a Claude subscription (Pro, Max, Team or Enterprise) or a Claude Console account with API credits.
  • Network: Claude Code needs an internet connection and is only available in the countries Anthropic supports.

Install on macOS and Linux

Anthropic recommends the native installer, which also keeps itself updated in the background:

curl -fsSL https://claude.ai/install.sh | bash

The installer shows no progress while it downloads, so let it finish. Then open a new terminal and check the version:

claude --version
Installing Claude Code with the native installer and starting the first session
Installing Claude Code, checking the version and starting the first session

If you prefer Homebrew, that works too. However, it does not update itself, so run brew upgrade claude-code now and then:

brew install --cask claude-code

Install on Windows

Run this in PowerShell (no Administrator needed):

irm https://claude.ai/install.ps1 | iex

Two notes for Windows:

  • Install Git for Windows as well. Without it, Claude Code runs commands through PowerShell instead of Bash, and many project scripts will not run as written.
  • If your projects are Linux-based (Docker, Bash scripts), install and run it inside WSL 2 instead.

Your first Claude Code session

Go to your project folder and run claude:

cd ~/projects/my-app
claude

The first time, it asks you to log in. A browser opens, you sign in with your Claude account and come back to the terminal. After that, it remembers you.

The first thing I do on any new project is ask Claude Code to explain it. That way I see how well it reads the code, and I get a quick map of the project:

What does this project do, and where is its main entry point?

You do not need to hand it files; Claude Code reads whatever it needs. As a result, its first answer usually takes a few seconds.

Your first change and permission modes

Give it a small task, for example "add a health endpoint to the API that returns 200". Before every file change or command, it asks for your permission. Press Shift+Tab to switch the session's permission mode, for example to let it edit files without asking.

Even so, my advice is to let it ask for everything in the first few days. Once its behaviour on your project is predictable, open up the permissions.

Claude Code commands you will use every day

  • /init: creates a CLAUDE.md file for the project. More on that below.
  • /clear: clears the conversation. Start a clean session for each new task so earlier talk does not confuse the agent.
  • /resume: continues an earlier conversation.
  • /login: switch accounts or sign in again.
  • /help: lists every command.

Three habits that pay off from day one

1. Write a short CLAUDE.md

The agent starts every session from zero and guesses whatever you have not written down. The CLAUDE.md file in the project root is read at the start of every session. /init writes a first version, but trim it and keep only what the code itself does not show. In What goes in CLAUDE.md I show with a real experiment how much a twenty-line file changes the result.

2. Give it small tasks

"Build the payment system" means dozens of decisions the agent has to make on its own. "Add an endpoint that creates an order with these inputs, and write a test for it" is a task you can review. The smaller the task, the shorter the diff and the easier the review.

3. Read the diff before you accept it

The agent writes the code, but you are still responsible for it. I read every change before committing, run the tests, and only then push. This is the one habit I never skip.

Common install errors

  • command not found: claude: the install directory is not on your PATH. Open a new terminal; if that does not help, follow the install troubleshooting guide to add it.
  • The token '&&' is not a valid statement separator: you ran the CMD command in PowerShell. Use the PowerShell command above.
  • 'irm' is not recognized: the opposite; you are in CMD. Open PowerShell.
  • The installer says not found on Alpine: run apk add bash curl first.

Next step

Installing and running a first session is easy. What really makes Claude Code's output good or bad is not how nicely you phrase a request; it is how much of your project's rules you have written somewhere the agent can read. Start with CLAUDE.md. As the project grows, path-scoped rules and a spec before code are the next steps.

Comments

Sign in to leave a comment.

Sign in

Loading…

Related posts