Claude Code macOS/Linux Setup Guide

Complete macOS/Linux system installation steps to get you started with Claude Code quickly

8 min read
Official Source Installation
This process uses 100% official source services for installation, ensuring your technical setup is completely consistent with the official version

System Requirements

  • macOS/Linux: No specific requirements
  • Node.js: Version 20+

Installation Steps

1

Open Terminal

Use Cmd+Space to search for "Terminal" or find Terminal in Applications → Utilities

2

Verify Node.js Installation

Check if Node.js is installed. If not, download from https://nodejs.org/en/download

$ node -v
$ npm -v
3

Uninstall Existing Claude Code (skip if not installed)

$ npm uninstall -g @anthropic-ai/claude-code

Install Official Version

$ npm install -g @anthropic-ai/claude-code@1.0.80
5

Configure API Settings

Create a settings.json file to configure the API endpoint:

$ vim ~/.claude/settings.json

Add the following content:

{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "paste your API key here",
    "ANTHROPIC_BASE_URL": "https://api.aicodeditor.com",
    "CLAUDE_CODE_MAX_OUTPUT_TOKENS": "32000",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
    "API_TIMEOUT_MS": "600000",
    "BASH_DEFAULT_TIMEOUT_MS": "600000",
    "BASH_MAX_TIMEOUT_MS": "600000",
    "MCP_TIMEOUT": "30000",
    "MCP_TOOL_TIMEOUT": "600000",
    "CLAUDE_API_TIMEOUT": "600000"
  },
  "permissions": {
    "allow": [],
    "deny": []
  }
}

Verify Installation

Run the following command to confirm successful installation:

$ claude -v

If a version number is displayed, the installation was successful.

Getting Started

After installation is complete, you can start using Claude Code in any project directory:

# Navigate to project directory
$ cd your-project-folder
# Start Claude Code
$ claude

Important Notes

Using Opus Model: Set CLAUDE_CODE_MAX_OUTPUT_TOKENS to 32000 for optimal performance.

Restart Claude Code: After modifying configuration, please restart Claude Code for changes to take effect.

Advanced Tips

Use Aliases for Shortcuts

Add to your ~/.bashrc or ~/.zshrc:

alias cc="claude"

Project-Specific Configuration

Create .claude/settings.json in project root:

mkdir .claude && touch .claude/settings.json

Troubleshooting

Permission Issues: If you encounter permission errors during installation, you may need to use sudo or configure npm global directory.

Node.js Version: Ensure you're using Node.js 20+. You can use nvm to manage multiple Node.js versions.

Environment Variables: If the command is not available, check that your PATH environment variable includes the npm global install directory.

Start Using Claude Code

Use our platform to easily configure your Claude Code API keys