Skip to Content
👋 Welcome to Claude Code Tutorials! Learn more
📚 TutorialGetting StartedInstallation & Setup

Installation & Setup

This chapter will guide you through the installation and initial configuration process for Claude Code.

Installing Claude Code

Prerequisites

  • Node.js >= 18.x
  • Valid Anthropic API key

Installation Steps

  1. Get Claude Code

    Visit the Claude Code website to get the latest version.

  2. Set up API Key

    export ANTHROPIC_API_KEY=your_api_key_here
  3. Verify Installation

    claude --version

Initial Configuration

Create CLAUDE.md File

Create a CLAUDE.md file in your project root:

# CLAUDE.md This is my project configuration file that Claude will automatically read. ## Common Commands - npm run build: Build the project - npm run test: Run tests - npm run lint: Code linting ## Project Standards - Use TypeScript - Follow ESLint rules - Prefer functional components

Configure Tool Permissions

On first run, Claude Code will request tool permissions. Recommended:

  1. Always allow:

    • Read - File reading
    • Write - File writing
    • Bash(git *) - Git commands
  2. Use with caution:

    • Bash(rm *) - Delete commands
    • Bash(sudo *) - Admin privileges

Environment Variables

Add to your .bashrc or .zshrc:

# Claude Code Configuration export CLAUDE_CONFIG_PATH="$HOME/.claude" export CLAUDE_DEFAULT_MODEL="claude-3-sonnet"

Verify Configuration

Run this command to verify your setup:

claude -p "Read the README.md file in current directory and summarize it"

If everything is working correctly, Claude Code will read and summarize your README file.

Common Issues

Q: API key not recognized

A: Ensure environment variables are set correctly, restart terminal and try again.

Q: Permission denied

A: Check file permissions, ensure Claude Code can access the target directory.

Q: Cannot connect to service

A: Check network connection and API service status.


Next: Basic Usage - Learn basic Claude Code operations.

Last updated on: