Get up and running
Install Claude Code
Install the official Anthropic package globally via npm:Claude Code requires Node.js 18 or higher. The package uses Bun internally but is distributed as a standard npm package.
Authenticate
Run You have two options:
claude to start the setup flow. On first launch you will be prompted to authenticate:- OAuth (recommended): Follow the browser-based OAuth flow to connect your
claude.aisubscription account. - API key: Set the
ANTHROPIC_API_KEYenvironment variable before runningclaude:
On macOS, Claude Code stores credentials securely in the system Keychain. You will see a permission dialog on first use.
Navigate to your project
Claude Code uses your working directory to understand project context. Change to your project root before starting a session:
Run your first task
Type a natural language request at the prompt. Claude Code will read your codebase, propose a plan, and ask for permission before making changes:Claude Code will use its built-in tools — file reading, grep search, glob matching — to explore your project and return a detailed report.
Interactive REPL
When you runclaude without arguments, you enter the interactive REPL. The session looks like this:
/help to see available commands.
To exit the REPL, press Ctrl+C or type /exit.
Headless mode
For scripting, CI pipelines, or programmatic use, pass a task with-p and get structured output:
--output-format json flag returns machine-readable output including the assistant’s response and any tool calls made during the task.
First commands to try
Once you are in the REPL, these commands help you orient yourself:| Command | Description |
|---|---|
/init | Initialize Claude Code for your project — generates a CLAUDE.md with project context |
/help | List all available slash commands |
/doctor | Run diagnostics and verify your installation and authentication |
/model | Switch between available Claude models |
/compact | Manually compact the conversation context when it grows large |
Permission dialogs
On first use, Claude Code will present a workspace trust dialog asking you to confirm it can operate in the current directory. Subsequent tool calls (file writes, shell commands) will prompt for approval unless you configure anauto permission mode.