How to Set Up Claude Code: Install, Configure and Actually Use It

Before you start: versions, package names and storage identifiers change over time. Check the commands against the official documentation for your setup before running them, especially anything that creates, deletes or overwrites data.

How to Set Up Claude Code: Install, Configure and Actually Use It

By the end of this guide you will have the Claude Code command‑line interface installed on your workstation, authenticated with your Anthropic API key, a small test project initialized with a CLAUDE.md file, and your preferred default settings (model, temperature, output format) saved for everyday use. You will be able to run Claude Code commands from any terminal and see a coherent response from the model. The whole process usually takes between fifteen and thirty minutes, depending on how quickly you can locate your API key and whether you need to create a virtual environment.

More Tutorials & Self-Hosting guides on TechPulseMind →

Prerequisites

Category Requirement Notes / Verification
Hardware Any modern x86_64 or ARM64 workstation capable of running the host OS No special GPU or storage is needed.
Operating System Linux (Ubuntu 22.04 LTS or later, Debian 12, Fedora 39+ or equivalent), macOS 13+ (Ventura or later), or Windows 10/11 (WSL2 recommended) See the official Claude Code documentation for the exact minimum version.
Software A supported Python interpreter (the official install method uses pip), git (optional but useful), and a terminal with sudo or administrative rights if you intend a system‑wide install Check the documentation for the minimum Python version required by the Claude Code package.
Account / Access An Anthropic account with API access enabled and a personal API key copied from the Anthropic console The documentation shows where to generate the key in the dashboard.
Network Outbound HTTPS access to api.anthropic.com on port 443 Make sure any corporate firewall or proxy allows this endpoint.

If you prefer to keep the installation isolated from your system Python, you can create a virtual environment later in the guide; otherwise be ready to type your password for a sudo‑protected pip install.

Step‑by‑step guide

  1. First verify that the basic tools are present and meet the version requirements. Open a terminal and run the version checks for Python and git. This tells you whether you satisfy the software prerequisites before proceeding.

    Explanation: python3 --version prints the interpreter version; git --version shows the git client version.

    python3 --version
    git --version
    
  2. Install the Claude Code package using the method recommended by Anthropic. The official documentation typically suggests a plain pip install; you can add the --user flag to avoid needing sudo, or you can omit it for a system‑wide install if you are comfortable entering your password.

    Explanation: This command downloads the latest release from PyPI and places the executable in the appropriate bin directory.

    pip install --user claude-code
    

    If you encounter an “externally‑managed environment” error on a recent Linux distribution, see the troubleshooting section later for a virtual‑environment workaround.

  3. Confirm that the installation succeeded and that the executable is on your PATH. The version command should return a string without error.

    Explanation: claude-code --version (or claude --version depending on the exact binary name) queries the installed package for its version number.

    claude-code --version
    

    If the command is not found, locate the install directory with pip show claude-code and add its bin folder to your PATH as described in the verification step.

  4. Set up authentication so the CLI can talk to Anthropic’s servers. The safest way is to export your API key as an environment variable in the current shell, or to add it to the configuration file that the CLI reads.

    Explanation: Exporting ANTHROPIC_API_KEY makes the key available to any child process; the CLI will pick it up automatically.

    export ANTHROPIC_API_KEY="sk-ant-…"
    

    Replace the placeholder string with the key you copied from the Anthropic console. To avoid re‑exporting the key in every new terminal, you can add the export line to your shell’s startup file (~/.bashrc, ~/.zshrc, or the equivalent for your shell).

    After setting the variable, run the auth‑status command to verify that the key is accepted.

    claude-code auth status
    

    You should see a message indicating “Authenticated” and possibly the account identifier associated with the key.

  5. Create a temporary workspace to test the initialization command. This will generate a CLAUDE.md file that serves as a project‑level manifest for Claude Code.

    Explanation: mkdir makes a new directory, cd changes into it, and claude-code init scaffolds the default files.

    mkdir ~/claude-test
    cd ~/claude-test
    claude-code init
    

    List the directory contents to confirm that CLAUDE.md (and any other expected files) appear.

    ls -la
    

    Open CLAUDE.md with your preferred text editor to inspect the template header that the CLI inserted.

  6. Adjust the user‑level settings to match your typical workflow. The CLI reads a JSON (or YAML) configuration file; you can edit it safely with the built‑in edit command.

    Explanation: claude-code config --edit opens the correct configuration file in your default editor, allowing you to change values such as the default model, temperature, and output format.

    claude-code config --edit
    

    Inside the editor, locate the keys default_model, temperature, and output_format. Set them to values that suit your use‑case, for example:

    • "default_model": "claude-3-opus-20240229"
    • "temperature": 0.7
    • "output_format": "markdown"

    Save the file and exit the editor. Then run the show command to verify that your changes were persisted.

    claude-code config show
    

    The output should reflect the exact values you just saved.

  7. Run a simple query to ensure end‑to‑end functionality. This step confirms that authentication, configuration, and network connectivity are all working.

    Explanation: claude-code ask sends a prompt to the model and prints the response.

    claude-code ask "Explain the difference between a list and a tuple in Python."
    

    You should receive a coherent answer that mentions mutability, syntax, and typical use cases. No error messages about missing credentials, configuration, or time‑outs should appear.

  8. (Optional) Make the Claude Code binary easily reachable and enable shell completion. If you installed with the --user flag, the binary likely resides in ~/.local/bin. Adding that directory to your PATH lets you run the command from any location.

    Explanation: The export line appends the user‑local bin directory to your PATH for the current session; adding it to your shell startup file makes the change permanent.

    export PATH="$HOME/.local/bin:$PATH"
    

    To test completion for Bash, run the completion command and source the output; for Zsh or Fish consult the documentation for the appropriate syntax.

    claude-code completion bash > ~/.bash_completion.d/claude
    source ~/.bash_completion.d/claude
    

    Open a new terminal and type claude-code followed by the Tab key; you should see a list of sub‑commands.

Verification

After completing the steps above, run the following quick checks to confirm that each milestone was reached.

  • Tool availability: which claude-code returns a path inside ~/.local/bin (or the system bin directory if you used sudo).
  • Version reporting: claude-code --version prints a version string without error.

  • Authentication: claude-code auth status shows “Authenticated” and displays your account ID or email.
  • Project scaffolding: Inside the test directory, ls lists CLAUDE.md and optionally other default files.
  • Configuration persistence: claude-code config show outputs the exact values you set for default_model, temperature, and output_format.
  • Live query: claude-code ask "What is the capital of Japan?" returns a short answer (“Tokyo”) with no error output.

If all of these checks succeed, you have a fully functional Claude Code installation ready for everyday use.

Common failure modes and fixes

Symptom Likely cause Suggested fix
claude-code: command not found after installation The install directory is not in your PATH, or the install failed silently. Run pip show claude-code to locate the Location field. Add the bin sub‑folder to your PATH (e.g., export PATH="$HOME/.local/bin:$PATH") and restart the shell.
Authentication error: “Invalid API key” The ANTHROPIC_API_KEY variable is misspelled, empty, or the key lacks Claude access. Re‑copy the key from the Anthropic console, ensure there are no surrounding spaces, and export it again. Verify with claude-code auth status.
init command fails with “permission denied” on CLAUDE.md You attempted to initialize inside a directory you cannot write to (e.g., a system folder). Change to a user‑writable location such as ~/projects/claude-test before running init.
Settings edits are ignored You edited the wrong config file (project‑local instead of user‑global) or introduced a syntax error (invalid JSON). Always use claude-code config --edit to open the correct file. Validate JSON with jq . <configfile> or an online validator before saving.
Network timeout or “Unable to reach api.anthropic.com” Outbound HTTPS is blocked by a firewall/proxy, or missing CA certificates. Test connectivity with curl -v https://api.anthropic.com. If blocked, configure HTTPS_PROXY or add your corporate CA to the system trust store.
Version mismatch warning after upgrade You upgraded Claude Code but your config file contains deprecated keys. Check the release notes for breaking changes; run claude-code config migrate if the command exists, or manually remove/rename obsolete keys as instructed.
pip install fails with “externally‑managed environment” error (Linux) The system Python enforces PEP 668 (externally managed environment). Create a virtual environment: python3 -m venv ~/.venv/claude && source ~/.venv/claude/bin/activate && pip install claude-code. Then use the CLI from within the activated environment.

Next steps

Now that you have Claude Code ready, you can begin integrating it into your daily workflow.

  • Explore the full command set by running claude-code --help. Try sub‑commands such as edit, review, or embed on a real codebase.
  • If you use an editor like VS Code, Neovim, or JetBrains, look for an official Claude Code extension that lets you invoke the CLI without leaving the IDE.
  • Automate repetitive tasks: add Claude Code calls to your CI/CD pipelines (e.g., generate PR summaries or run automated code reviews) using the same ANTHROPIC_API_KEY secret stored in your CI secret manager.
  • Experiment with model parameters. Lower temperature for deterministic refactoring, raise it for creative brainstorming, and adjust max_tokens or stop sequences to fit the task.
  • Keep the tool up to date. Periodically run pip list --outdated or consult the official changelog; follow the upgrade instructions in the release notes when a new version appears.
  • Share feedback or report issues. The documentation points to the official repository or community forum where you can file bugs or suggest features.

With the CLI installed, authenticated, and configured, you are ready to let Claude Code assist you in writing, reviewing, and understanding code directly from your terminal. Happy hacking!

Related reading

Frequently Asked Questions

Is Claude Code free to use?

Claude Code requires an Anthropic account with API access or a subscription that includes it. The CLI itself is free to install, but the model calls it makes are billed to your account, so check the current pricing page before running long sessions.

Does Claude Code work offline?

No. The CLI runs locally but every request is sent to Anthropic's servers, so an internet connection is required. Nothing in the tool caches model responses for offline use.

Can I use Claude Code on Windows?

Yes. It runs on Windows, macOS and Linux. On Windows many users run it inside WSL for a smoother experience with Unix-style tooling, but a native shell works as well.

What is CLAUDE.md for?

CLAUDE.md is a project file where you record conventions, commands and context that should apply to every session in that repository. Anything written there is loaded automatically, so you do not have to repeat the same instructions each time.

Some links on this page may be affiliate links. If you buy through them we may earn a commission at no extra cost to you. See our affiliate disclosure.

Beginner’s Guide to Installing Proxmox VERead next