Installation Beginner
Get Claude Code installed and running in just a few minutes. This guide walks you through prerequisites, installation, authentication, and your first run on macOS, Linux, and Windows.
Prerequisites
Before installing Claude Code, make sure you have the following:
| Requirement | Minimum Version | How to Check |
|---|---|---|
| Node.js | 18.0 or later | node --version |
| npm | Comes with Node.js | npm --version |
| Git | 2.x (recommended) | git --version |
| Operating System | macOS, Linux, or Windows (WSL) | — |
brew install node.
Verify Prerequisites
# Check Node.js version (must be 18+) $ node --version v20.11.0 # Check npm version $ npm --version 10.2.4 # Check git version (recommended but not strictly required) $ git --version git version 2.43.0
Install Claude Code
Claude Code is distributed as an npm package. Install it globally so you can use the claude command from anywhere.
-
Install globally via npm
Terminal
$ npm install -g @anthropic-ai/claude-code
Permission Error? If you see anEACCESpermission error on macOS/Linux, either fix your npm permissions (recommended) or usesudo npm install -g @anthropic-ai/claude-code. -
Verify the installation
Terminal
$ claude --version claude-code/1.x.x
If you see a version number, Claude Code is installed correctly.
Platform-Specific Instructions
macOS
# Option 1: Install Node.js via Homebrew (recommended) $ brew install node # Option 2: Install Node.js via the official installer # Download from https://nodejs.org # Then install Claude Code $ npm install -g @anthropic-ai/claude-code
Linux (Ubuntu/Debian)
# Install Node.js via NodeSource (recommended for latest versions) $ curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - $ sudo apt-get install -y nodejs # Or use nvm (Node Version Manager) $ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash $ nvm install 20 $ nvm use 20 # Install Claude Code $ npm install -g @anthropic-ai/claude-code
Windows (via WSL)
# Step 1: Install WSL if not already installed PS> wsl --install # Step 2: Restart your computer, then open Ubuntu from Start Menu
# Install Node.js inside WSL $ curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - $ sudo apt-get install -y nodejs # Install Claude Code $ npm install -g @anthropic-ai/claude-code # Navigate to your Windows project (accessible via /mnt/c/) $ cd /mnt/c/Users/YourName/projects/my-app $ claude
/mnt/c/.
Authentication
Claude Code needs an API key to communicate with Claude. You have two options for authentication:
Option 1: Interactive Login (Recommended)
When you run claude for the first time, it will guide you through the login process.
$ claude # Claude Code will open your browser for authentication # Log in with your Anthropic account # Your credentials are saved locally for future sessions
Option 2: API Key via Environment Variable
Set the ANTHROPIC_API_KEY environment variable directly:
# Set the API key for the current session $ export ANTHROPIC_API_KEY="sk-ant-api03-your-key-here" # Or add it to your shell profile for persistence $ echo 'export ANTHROPIC_API_KEY="sk-ant-api03-your-key-here"' >> ~/.bashrc $ source ~/.bashrc
First Run Walkthrough
Once installed and authenticated, here is what your first Claude Code session looks like:
-
Navigate to a project directory
Terminal
$ cd ~/projects/my-web-app
-
Start Claude Code
Terminal
$ claudeClaude Code will display a welcome message and a prompt where you can type your requests.
-
Ask your first question
Claude Code
Claude > What does this project do? Give me a high-level overview.Claude will read your project files and give you a summary of the codebase structure, technologies used, and main functionality.
-
Try a simple edit
Claude Code
Claude > Add a comment at the top of README.md with today's dateClaude will show you the proposed edit and ask for your approval before making the change.
Troubleshooting Common Issues
This means the npm global bin directory is not in your PATH. Fix it by running:
# Find where npm installs global packages $ npm config get prefix # Add the bin directory to your PATH $ echo 'export PATH="$(npm config get prefix)/bin:$PATH"' >> ~/.bashrc $ source ~/.bashrc
Fix npm permissions instead of using sudo. The recommended approach is to change npm's default directory:
$ mkdir ~/.npm-global $ npm config set prefix '~/.npm-global' $ echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc $ source ~/.bashrc $ npm install -g @anthropic-ai/claude-code
Claude Code requires Node.js 18 or later. Upgrade using nvm (Node Version Manager):
$ nvm install 20 $ nvm use 20 $ node --version # Should show v20.x.x $ npm install -g @anthropic-ai/claude-code
If you see authentication errors:
- Verify your API key is correct at console.anthropic.com
- Make sure the
ANTHROPIC_API_KEYenvironment variable is set:echo $ANTHROPIC_API_KEY - Check that your API key has not been revoked or expired
- Ensure you have sufficient credits in your Anthropic account
If you are behind a corporate proxy or firewall:
# Set proxy for npm $ npm config set proxy http://proxy.company.com:8080 $ npm config set https-proxy http://proxy.company.com:8080 # Set proxy for Claude Code API calls $ export HTTPS_PROXY="http://proxy.company.com:8080"
Updating Claude Code
Keep Claude Code up to date to get the latest features and bug fixes:
# Update to the latest version $ npm update -g @anthropic-ai/claude-code # Check the installed version $ claude --version
Uninstalling
# Remove Claude Code $ npm uninstall -g @anthropic-ai/claude-code # Optionally remove configuration files $ rm -rf ~/.claude
Try It Yourself
Install Claude Code on your system and run claude --version to verify it works. Then navigate to any project directory and start a session with claude. Ask it to describe the project to you.
Lilly Tech Systems