← All articles
AI Tools1 min read

Setting Up the Claude Code CLI

Claude Code brings Anthropic's models into your terminal as an agentic coding assistant. Here's how to install, authenticate, and configure it.

S

Swapnika Voora

Author

Claude Code is Anthropic's command-line coding agent. Unlike a chat box, it runs in your project directory, reads your files, and can make edits — so getting the install and permissions right matters before you turn it loose.

Install the CLI

Claude Code installs globally through npm and requires a recent Node runtime.

install.sh
node --version        # needs Node 18 or newer
npm install -g @anthropic-ai/claude-code
claude --version

Authenticate

Run claude once and it walks you through browser-based login, or supply an API key through the environment for headless setups like CI.

auth.sh
claude            # interactive: opens a browser to log in
# or, for scripts and CI:
export ANTHROPIC_API_KEY="sk-ant-..."

Point it at a project

Launch Claude Code from your repository root so it has the right working context. It reads a CLAUDE.md file for project-specific instructions.

CLAUDE.md
# Project conventions
- Use Java 21 and Spring Boot 3.
- Never edit files under `generated/`.
- Run `./mvnw test` before proposing a commit.

Verify and scope permissions

On first run, Claude asks before editing files or running commands. Review those prompts — the tool is powerful, and a CLAUDE.md plus careful approvals keep it predictable.

Takeaways

  • Install globally with npm on Node 18+.
  • Use interactive login locally and ANTHROPIC_API_KEY for automation.
  • A CLAUDE.md at the repo root encodes conventions the agent will follow.

Start it in a repo with a clean git tree so you can review and revert everything the agent does through normal version control.

#claude#anthropic#cli#setup

More in AI Tools