Claude Code Setup Guide

Install and configure Anthropic's CLI coding assistant

Last updated: May 20, 2026

What's New (May 2026)

What is Claude Code?

Claude Code is Anthropic's official CLI tool that brings Claude's coding capabilities directly to your terminal. It's like having an AI pair programmer who can read your files, run commands, and help you debug in real-time.

💡 Why use it? Unlike chat interfaces, Claude Code works directly in your development environment, can execute commands, edit multiple files at once, and maintains context across your entire project.

Prerequisites

1 Install Claude Code

Install globally using npm (Node package manager):

Terminal
npm install -g @anthropic-ai/claude-code

This installs the claude command globally on your system.

2 Authenticate with Anthropic

Run the login command to set up your API key:

claude login

This will open your browser to authenticate with Anthropic. Once approved, your API key is stored securely.

⚠️ Tip: If you prefer not to use browser auth, you can set the ANTHROPIC_API_KEY environment variable instead.

3 Start a Session

Navigate to your project directory and run:

cd your-project && claude

You'll enter an interactive chat session where Claude can help you with coding tasks.

Essential Commands

Command Description
claude Start interactive session
/help Show all available commands
/model Switch models mid-session (new in 2026)
/resume Resume background session (new in 2026)
/clear Clear conversation history
/exit End session

🦀 OpenClaw Integration

Claude Code is built into OpenClaw! If you're using OpenClaw as your AI orchestrator, you already have Claude Code capabilities.

To use Claude Code through OpenClaw:

claude command works the same way

See the OpenClaw Setup Guide for full integration details.

Troubleshooting

"command not found: claude"

Node.js isn't installed or npm global bin directory isn't in your PATH. Run npm install -g @anthropic-ai/claude-code or see the Node.js setup guide.

Authentication failed

Your API key may be invalid or expired. Run claude logout then claude login again.

Session crashes or hangs

Try updating to the latest version: npm update -g @anthropic-ai/claude-code

Official Resources

← Back to All Guides OpenClaw Setup →