Claude Code CLI Beginner's Guide: From Installation to Your First AI Coding Task
What This Tutorial Teaches
Claude Code is Anthropic's AI coding agent that runs in your terminal. It can read your project, edit files, run commands, and automate development tasks — all from a command line. By the end of this tutorial, you will be able to install Claude Code, sign in, and complete your first AI-assisted coding task.
Which version is covered? This tutorial covers the Claude Code CLI — the version you run in your terminal. It does not cover the desktop app or the web version. If you want the graphical desktop app instead, jump straight to the Claude Code Desktop App: Installation & First Use Guide.
Time needed: 15–20 minutes
Difficulty: Beginner
Before You Start
| Requirement | Details |
|---|---|
| Operating system | macOS 13 or later, Windows 10 1809 or later, or Linux (Ubuntu 20.04+, Debian 10+, Alpine 3.19+) |
| Account | A Claude Pro, Max, Team, or Enterprise subscription, or a Claude Console account (pay-as-you-go) |
| Terminal | PowerShell (Windows), Terminal (macOS), or your Linux terminal |
| Hardware | At least 4 GB of RAM |
| Cost | Claude subscription (Pro from $20/month), or pay per API usage |
What is a terminal? A terminal (also called command line) is a window where you type commands instead of clicking buttons. On Windows it is called PowerShell; on macOS it is called Terminal. This tutorial uses claude commands, which you type into this window and press Enter.
What is Claude Code? Claude Code is a coding agent from Anthropic. It reads your files, understands how the parts of your project connect, and can edit multiple files, run tests, and fix errors by itself — after asking for your permission.
What is an API key? An API key is a secret code that identifies your account when paying per use. You generate it once in the Claude Console (console.anthropic.com). Treat it like a password — never share it.
How to Open Your Terminal (Step by Step)
If you are not sure how to open a terminal, follow the steps for your system below. You will use it for every command in this tutorial.
Windows — open PowerShell
- 1Click the Start button (the Windows logo) at the bottom-left corner of your screen.
- 2Type
PowerShell— you do not need to click anything first, just start typing. - 3Click the Windows PowerShell or Terminal app that appears in the list.
- Windows 11 shows Terminal; Windows 10 shows Windows PowerShell. Either one works.
- 1If a blue User Account Control window pops up, click Yes.
How to paste a command: right-click anywhere inside the PowerShell window to paste (or press Ctrl + V).
Download and Install
Choose Your Version
| Version | Best for | Notes |
|---|---|---|
| Native installer (recommended) | Most users | Fully tested, recommended; updates automatically in the background |
| Homebrew | macOS users who already use Homebrew | Manage alongside other apps; update manually |
| WinGet | Windows users who already use WinGet | Windows package manager; update manually |
What is Homebrew? Homebrew is a free package manager for macOS. You type brew install to install programs, just like an app store for the command line. Only choose this option if you already use Homebrew.
What is WinGet? WinGet is the official package manager built into Windows 10 and 11. Only choose this option if you already use it.
Install for Your System
Select your system below. Each tab contains the complete steps for that operating system.
Windows installation
- 1Open PowerShell: click the Start button (Windows logo), type
PowerShell, then click Windows PowerShell or Terminal. - 2Copy the command below, paste it into the PowerShell window, and press Enter:
irm https://claude.ai/install.ps1 | iex- 1Wait for the installation to finish. When you can type again, verify the installation by copying and running this command:
claude --versionIf you see a version number followed by (Claude Code) (for example 2.1.211 (Claude Code)), the installation succeeded.
Using CMD instead of PowerShell: if your terminal shows C:\ without PS at the start of the line, you are in CMD. Run this command instead:
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmdIf you see The token '&&' is not a valid statement separator, you are in PowerShell — use the irm command above. If you see 'irm' is not recognized as an internal or external command, you are in CMD — use the curl command above.
Update Claude Code: native installations update automatically. To check for updates immediately, run:
claude updateOptional — WinGet: if you prefer the WinGet package manager:
winget install Anthropic.ClaudeCodeUpdate it with:
winget upgrade Anthropic.ClaudeCodeSign In
- 1Open a terminal and go to a project folder (replace
path/to/your/projectwith your own folder path):
cd path/to/your/project- 1Start Claude Code:
claude- 1The first time, you will be asked to log in. A browser window opens automatically:
- Sign in with your Claude account — use your Pro, Max, Team, or Enterprise subscription. After you sign in, the browser returns your credentials to Claude Code automatically.
- Use the Claude Console (API) — if you prefer pay-as-you-go usage, sign in with your Console account instead.
- 1After signing in, you will see the Claude Code prompt, ready for your first task. Your login is stored, so you will not need to sign in again.
Note: the free Claude.ai plan does not include Claude Code. You need a paid subscription or a Console account.
Installation Troubleshooting
| Error | Cause | Fix | |
|---|---|---|---|
claude: command not found | The install folder is not in your PATH | See the step-by-step fix below for your system | |
'irm' is not recognized as an internal or external command | You ran the PowerShell command in CMD | Use the CMD install command instead (curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd) | |
The token '&&' is not a valid statement separator | You ran the CMD command in PowerShell | Use the PowerShell install command instead (`irm https://claude.ai/install.ps1 \ | iex`) |
syntax error near unexpected token '<' or HTTP 403 during install | Network restriction, or the command was pasted into the wrong shell | Check your internet connection, make sure claude.ai is accessible, and retry in the correct terminal type | |
| Browser login page does not open | Network restrictions or proxy | Check your internet connection and try again. If you use a VPN or proxy, try turning it off or switching servers | |
Login expired · Please run /login | Your stored login expired | Run claude, then type /login inside the session and sign in again |
Fix for "claude: command not found" — Windows:
- 1Press the Windows key, type
environment variables, and click Edit the system environment variables. - 2Click the Environment Variables... button.
- 3In the lower list (System variables), find Path, select it, and click Edit....
- 4Click New, add the folder where Claude Code was installed (default:
C:\Users\<your username>\.local\bin), and click OK on every window. - 5Close PowerShell completely and open it again, then run
claude --version.
Fix for "claude: command not found" — macOS/Linux:
- 1Open Terminal and copy-run this command:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc- 1Reload the settings:
source ~/.zshrc- 1If you use Bash instead of Zsh, use
~/.bashrcin both commands above. - 2Run
claude --versionto confirm.
Your First Task
Step 1: Open a project
Go to the project folder you want Claude Code to work on (replace the path with yours):
cd path/to/your/projectYou should now see the folder path in your terminal prompt.
Step 2: Start Claude Code
claudeClaude Code starts and shows its prompt with the version, the current model, and the folder you are working in.
Step 3: Ask your first question
Type this request and press Enter:
What does this project do?Claude Code reads the project files and explains what it finds. Try a few more:
What technologies does this project use?— identifies the technologies in the projectWhere is the main entry point?— finds the main fileExplain the folder structure— explains how the folders are organized
Step 4: Make your first code change
Type this request and press Enter:
Add a hello world function to the main fileClaude Code finds the right file, shows you the proposed changes, and asks for your approval. This is normal and safe — you decide what happens on your machine.
Step 5: Approve or reject changes
When Claude Code wants to edit files or run commands, it asks for your permission first. Type y and press Enter to approve, or n to reject. Review each change — you stay in control.
You can also press Shift + Tab to cycle through permission modes:
- Default mode — Claude asks before each change
- acceptEdits mode — file edits are approved automatically (commands still ask)
- plan mode — Claude only proposes a plan and changes nothing
Step 6: Exit Claude Code
When you are done, type /exit and press Enter, or press Ctrl + D twice.
Useful Commands
| Command | What it does |
|---|---|
claude | Start an interactive session |
claude "task description" | Start a session with a one-time task |
claude -p "query" | Run a one-off query and exit (good for scripts) |
claude -c | Continue your most recent conversation in this folder |
claude -r | Resume a previous conversation |
claude update | Update to the latest version |
claude doctor | Check that your installation is healthy |
/help | Show all available commands (inside a session) |
/clear | Clear the conversation history (inside a session) |
/login | Switch accounts or sign in again (inside a session) |
/usage | Show usage and cost for the session (inside a session) |
/exit or Ctrl + D twice | Exit Claude Code |
Frequently Asked Questions
Do I need a paid plan?
Yes. Claude Code requires a paid Claude subscription (Pro from $20/month billed monthly, Max from $100/month, Team, or Enterprise) or a Claude Console account with pay-as-you-go API usage. The free Claude.ai plan does not include Claude Code. Check the official pricing page for current options.
Does Claude Code work outside a git repository?
Claude Code works best inside a Git project. If you are starting from scratch, create a repository first:
git initCan Claude Code run my code?
Yes, with your permission. Claude Code can run shell commands and tests on your machine, and it always shows you what it runs before asking. Use the permission modes (Shift + Tab) to control what it can do without asking.
Is my code sent to Anthropic?
When you use Claude Code, your prompts and file contents are processed according to the data controls of your account type. Review Anthropic's data usage documentation for details.
What is MCP?
MCP (Model Context Protocol) is a standard way to connect Claude Code to external tools and data sources, such as databases or internal services. You can add MCP servers later with /mcp inside a session — it is an advanced feature, not required to start.
What's Next
- Add project guidance: Create a
CLAUDE.mdfile in your repository to give Claude Code durable instructions about your project. - Ask better questions: Be specific about what you want — describe the goal and the constraints instead of just "fix the bug".
- Learn the permission modes: Use
Shift + Tabto switch between asking-permission and more autonomous modes as you gain confidence. - Try Claude Code elsewhere: Claude Code is also available as a desktop app, in VS Code and JetBrains IDEs, and on the web.
- Connect tools with MCP: Use
/mcpto give Claude Code access to external data and services.