في هذه الصفحة
التنصيب على macOS و Windows
ما ستتعلّمه
- تنصيب Claude Code على macOS باستخدام npm
- تنصيبه على Windows (عبر WSL)
- تسجيل الدخول وتشغيل أوّل أمر
- معالجة المشكلات الشائعة في التنصيب
Installing Claude Code takes a few minutes. Let's walk through it.
macOS
Claude Code is distributed as an npm package. If you have Node.js 18+ installed, you can install it globally:
npm install -g @anthropic-ai/claude-code
Verify the install:
claude --version
If you see a version number, you're good.
Authenticate
The first time you run claude, you'll be prompted to log in. Two options:
- Claude Pro / Max subscription: log in with your Anthropic account (recommended — no API cost per message)
- API key: set
ANTHROPIC_API_KEYin your shell profile
export ANTHROPIC_API_KEY="sk-ant-..."
Then:
cd ~/Projects/my-project
claude
Windows
Claude Code runs on Windows, but the best experience is via WSL (Windows Subsystem for Linux). Install WSL first if you haven't:
wsl --install
Restart, open your WSL terminal (Ubuntu by default), then install Node and Claude Code inside WSL:
# Install Node (if not already)
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
# Install Claude Code
npm install -g @anthropic-ai/claude-code
Your projects should live inside the WSL filesystem (~/ inside WSL, not /mnt/c/) for best performance.
First-run configuration
The first time you run claude in a project, it creates a .claude/ folder and writes your preferences. You don't need to touch these files manually — Claude Code manages them.
Troubleshooting
command not found: claude — The global npm bin directory isn't in your PATH. Run npm config get prefix and add <prefix>/bin to your PATH.
Corporate network / proxy — Set HTTPS_PROXY in your shell environment before launching Claude Code.
Permission errors on install — On macOS or Linux, avoid sudo npm install -g. Instead, configure npm to use a local prefix: npm config set prefix ~/.npm-global, then add ~/.npm-global/bin to your PATH.
Next
You have Claude Code installed and authenticated. Next lesson: starting your first project.
تأمّل
ما البيئة التي تكتب فيها معظم الشيفرة؟ تأكّد من أنّ Claude Code يعمل فيها بسلاسة قبل المتابعة.