Installing and signing in

Claude Code · Essentials · 8 min

Every later lesson assumes a working claude command and an authenticated account.

Claude Code is a program you install once on your computer. The recommended way is the native installer, which also keeps itself up to date in the background. Open a terminal (the text window where you type commands) and run the line for your system:

curl -fsSL https://claude.ai/install.sh | bash   # macOS, Linux, WSL

On Windows PowerShell the command is irm https://claude.ai/install.ps1 | iex. Package managers also work: brew install --cask claude-code on macOS or winget install Anthropic.ClaudeCode on Windows, but those do not auto-update, so you upgrade them yourself.

Open a new terminal window and check it worked with claude --version. If the shell says the command is not found, the install folder is not on your PATH (the list of folders your shell searches for programs); the troubleshooting page explains the fix.

Next, go into a project folder and start it:

cd my-project
claude

The first time, Claude Code asks you to log in and opens a browser page. You can use a Claude subscription (Pro, Max, Team or Enterprise), a Claude Console account (pay-as-you-go API credits), or a cloud provider your company has set up. Credentials are stored, so you only log in once. Inside a session, /login switches accounts and /logout signs out.

If the ANTHROPIC_API_KEY environment variable is set, Claude Code asks whether to use that key instead of logging in. That is common for scripts, but remember an API key bills per use.

On native Windows, installing Git for Windows is recommended so Claude Code can use a Bash shell; WSL setups do not need it.

Example

# macOS / Linux / WSL: native install (auto-updates)
curl -fsSL https://claude.ai/install.sh | bash

# or with Homebrew (update manually with: brew upgrade claude-code)
brew install --cask claude-code

claude --version        # prints a version number followed by (Claude Code)

cd ~/code/my-project
claude                  # first run opens a browser to log in
# inside the session:
#   /login    switch account or re-authenticate
#   /status   show version, model, account and connectivity

Remember

  • The native installer is recommended and updates itself; Homebrew and WinGet need manual upgrades
  • Run claude inside a project folder; the first run asks you to log in
  • /login and /status manage and check your account from inside a session

Watch out for

  • Opening the same old terminal window after installing and concluding the install failed; open a new window so PATH changes apply.

Check yourself

  1. You installed Claude Code with Homebrew. How do you get new versions?

Sign in to answer, see the explanations, and get this lesson back as a quick review later.

Official docs: code.claude.com/docs/en/quickstart