Claude Code is Anthropic’s powerful agentic coding assistant that runs directly in your terminal—able to understand your entire codebase, make edits, handle git workflows, debug, document, and more, all through natural language commands.
Table of Contents
Prerequisites
- Operating System: Modern Linux distribution (e.g., Ubuntu 18.04+, CentOS 7+)
- Node.js: Version 18 or newer required
- Terminal Access: To run installation commands and use Claude Code
- Optional but Recommended: ripgrep for enhanced search capabilities
- Anthropic Access:
- Authenticate through the Anthropic Console (requires active billing), or
- Use a Claude Pro or Max subscription, or
- Integrate via enterprise platforms like AWS Bedrock or Google Vertex AI
Installation Methods
Method 1: Installing via npm (Official & Recommended)
- Install globally:
npm install -g @anthropic-ai/claude-codeAvoid using
sudoto prevent permission issues and security risks. - If you encounter permission errors, configure npm to use a user directory instead of system paths:
mkdir -p ~/.npm-global
npm config set prefix ~/.npm-global
echo 'export PATH=$HOME/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc - Run a check:
claude doctor
Method 2: Native Binary (Beta)
If you prefer a script-based installer over npm:
- Stable version:
curl -fsSL <https://claude.ai/install.sh> | bash - Latest version:
curl -fsSL <https://claude.ai/install.sh> | bash -s latest - Specific version:
curl -fsSL <https://claude.ai/install.sh> | bash -s 1.0.58
For Alpine Linux or musl-based systems:
apk add ripgrep
export USE_BUILTIN_RIPGREP=0
Then run the installer again.
Getting Started
- Navigate to your project directory:
cd path/to/your-project - Launch Claude Code:
claude - Authenticate:
- Log in using the Anthropic Console, or
- Use Claude Pro/Max credentials, or
- Configure via a cloud platform if required
- Begin interacting:
Claude Code will prompt you with a terminal experience where you can type natural-language commands. Try things like:
> what does this project do?
> fix the type errors in auth module
> commit my changes with a descriptive message
Optional Enhancements & Configurations
- Choose your AI model:
export ANTHROPIC_MODEL="claude-sonnet-4-20250514" - Set API key via environment variable:
export ANTHROPIC_API_KEY="your_api_key_here" - Monitor usage and costs: You can track this via the Anthropic Console or CLI add-ons.
- Disable auto-updates if needed:
claude config set autoUpdates false --globalor
export DISABLE_AUTOUPDATER=1
Frequently Asked Problems
- Command not found after install → Check your
PATH; ensure~/.npm-global/binis included. - Permission errors → Don’t use
sudo; instead correct npm config as shown above. - Authentication failures → Try
claude > /logoutthen/login, and verify billing status. - Line ending issues (especially via WSL) → Ensure consistent Unix line endings in your project.
Best Practices & Tips
- Avoid using
sudo— it can lead to broken environments and security risks. - Choose the right model — Claude 4 for heavy workloads, Haiku for lightweight tasks.
- Customize config — disable auto-updates or set defaults as needed.
Summary: One-Minute Setup
# STEP 1: Install Node.js (if needed), configure npm
mkdir -p ~/.npm-global
npm config set prefix ~/.npm-global
echo 'export PATH=$HOME/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
# STEP 2: Install Claude Code
npm install -g @anthropic-ai/claude-code
# STEP 3: Verify
claude doctor
# STEP 4: Authenticate and run
cd your-project
claude
# Optional: Custom model + config
export ANTHROPIC_MODEL="claude-sonnet-4-20250514"
export DISABLE_AUTOUPDATER=1



