تعليمات خطوة بخطوة
- 1
خطوة
Check Node.js
استخدم الأمر القابل للنسخ كما هو، ثم تحقق من النتيجة قبل المتابعة. الهدف هو إبقاء سير العمل سريعاً لكن قابلاً للمراجعة.
node -v && npm -v - 2
خطوة
Install Codex Globally
استخدم الأمر القابل للنسخ كما هو، ثم تحقق من النتيجة قبل المتابعة. الهدف هو إبقاء سير العمل سريعاً لكن قابلاً للمراجعة.
npm install -g @openai/codex - 3
خطوة
Verify Installation
استخدم الأمر القابل للنسخ كما هو، ثم تحقق من النتيجة قبل المتابعة. الهدف هو إبقاء سير العمل سريعاً لكن قابلاً للمراجعة.
codex --version - 4
خطوة
Avoid Old Flags
استخدم الأمر القابل للنسخ كما هو، ثم تحقق من النتيجة قبل المتابعة. الهدف هو إبقاء سير العمل سريعاً لكن قابلاً للمراجعة.
codex
لماذا هذا مهم
يضمن لك استخدام حزمة NPM الرسمية `@openai/codex` الحصول على أحدث الميزات والتصحيحات الأمنية. غالبًا ما تشير الشروحات القديمة إلى مستودعات Github القديمة أو توصي بعلامات مثل `-q` والتي تعطل الأداة الحديثة بالكامل عند التشغيل.
استكشاف الأخطاء وإصلاحها
- **وسيطة غير متوقعة '-q'**: تمت إزالة العلم `codex -q`. قم بتشغيل الأداة باستخدام `codex` فقط.
- **رفض الإذن EACCES**: إذا واجهت خطأ في الأذونات على جهاز Mac، استخدم مدير إصدارات Node مثل `nvm` أو قم بتشغيل `sudo npm install -g @openai/codex`.
- **الأمر غير موجود**: في نظام Windows، تأكد من إضافة مسار التثبيت الشامل لـ NPM إلى متغيرات مسار بيئة النظام.
FAQ
What is the npm command for OpenAI Codex?
The official command is `npm install -g @openai/codex`. The `-g` flag is important because it makes the `codex` command available globally across all your project folders.
Does Codex CLI require Python or Node.js?
Codex CLI runs on Node.js. You do not need Python to install or run the standard Codex package, but you must have a recent version of Node.js installed.
Can I install Codex CLI with Homebrew instead of NPM?
While `brew install --cask codex` has been used historically for unofficial wrappers, the direct supported method from OpenAI is using NPM via the `@openai/codex` package.
How do I fix unexpected argument '-q' in Codex CLI?
Stop using the `-q` flag. Older versions used it to suppress prompts, but the current v0.130.0+ architecture rejects it. Just type `codex` and hit enter.
Is Codex CLI the same as Claude Code?
No. Codex is OpenAI's coding agent CLI, whereas Claude Code is Anthropic's terminal agent. They are installed differently and use different AI models on the backend.
دروس ذات صلة
Copilot
How to Install GitHub Copilot CLI on Mac and Windows
Step-by-step guide to installing the GitHub Copilot CLI extension. Learn how to authenticate and run gh copilot suggest and explain in your terminal.
Aider
كيفية تثبيت Aider AI Coding CLI على Mac و Windows
دليل خطوة بخطوة لتثبيت Aider AI pair programming CLI على macOS و Windows. تعلم كيفية تكوين مفاتيح API لـ Claude 3.7 و GPT-4o.