Back to Blog
BlogApril 7, 2026424

Qwen Code CLIのインストール方法:ターミナルAIコーディングエージェントのステップバイステップチュートリアル

Qwen Code CLIのインストール方法:ターミナルAIコーディングエージェントのステップバイステップチュートリアル

前提条件

Qwen Code CLI (Qwenモデルを基盤とした公式ターミナルベースAIコーディングエージェント)をインストールする前に、以下の要件を満たしていることを確認してください:

  • Node.js バージョン20以上(推奨:最新のLTS)。 nodejs.orgからダウンロードしてください 。
  • Windowsでは管理者権限を持つターミナルまたはコマンドプロンプト。
  • パッケージとモデルをダウンロードするためのインターネット接続。
  • オプションだが推奨:Git(手動ソースインストール用)およびmacOS/Linux用のHomebrew。

Node.jsのインストールを確認

node --version
npm --version

期待される出力は v20.x.x またはそれ以上のバージョンを示します。

ステップ1:インストール方法を選択する

Qwen Code CLIは複数のインストール方法を提供します。 クイックインストールスクリプト は依存関係を自動的に処理するため、ほとんどのユーザーに推奨されます。

クイックインストール(推奨)

Linux / macOS

bash -c "$(curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.sh)"

Windows (管理者としてコマンドプロンプトを実行)

curl -fsSL -o %TEMP%\install-qwen.bat https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.bat && %TEMP%\install-qwen.bat

実行後、ターミナルを再起動してPATHを更新してください。

ステップ2:npmによる手動インストール

手動制御を希望する場合:

npm install -g @qwen-code/qwen-code@latest

これにより qwen コマンドがグローバルにインストールされます。

sudoを使用するmacOS/Linux(パーミッションの問題が発生した場合):

sudo npm install -g @qwen-code/qwen-code@latest

ステップ3:Homebrewによるインストール(macOS & Linux)

brew install qwen-code

ステップ4:インストールの確認

以下のコマンドを実行して、インストールが成功したことを確認します:

qwen --version

以下のような出力が表示されるはずです:

Qwen Code CLI v0.x.x

ステップ5:初回起動と認証

対話型CLIを起動します:

qwen

初回実行時、CLIはQwenアカウントでの認証を促します(ワンクリックログインのためブラウザが開きます)。ログイン後、デフォルト設定が適用され、対話型ターミナルUIに入ります。

最良の結果を得るには、まずプロジェクトディレクトリに移動してください:

cd /path/to/your/project
qwen

セッション内では、 /help/model を使用してモデルを切り替えたり、 @filename でファイルを参照したりできます。

ステップ6:ソースからの手動インストール(上級者向け)

最新の未リリース変更を希望する開発者向け:

git clone https://github.com/QwenLM/qwen-code.git
cd qwen-code
npm install
npm install -g .

その後、 qwen --version で確認してください。

よくある問題とトラブルシューティング

  • コマンド 'qwen' が見つからない: ターミナルを再起動するか、hash -r (Linux/macOS) を実行してください。Windows では、コマンドプロンプトを閉じて再度開きます。Node.js のグローバル bin ディレクトリが PATH に含まれていることを確認してください。

  • npm install 中の権限エラー: Linux/macOS では sudo を使用するか、Windows では管理者としてコマンドプロンプトを実行してください。

  • Node.js のバージョンが古すぎる: nvm または公式インストーラーを使用して Node 20+ にアップグレードしてください。

  • Aliyun アセットでのネットワーク問題: フォールバックとして npm の方法をお試しください。

  • Termux または特定の Linux ディストリビューションでのインストール失敗: --ignore-scripts フラグを使用します: npm install -g @qwen-code/qwen-code@latest --ignore-scripts

  • 認証が機能しない: ブラウザがポップアップを許可していること、および有効な Qwen アカウントをお持ちであることを確認してください。

解決しない問題がある場合は、公式 GitHub リポジトリを確認してください: https://github.com/QwenLM/qwen-code

次のステップ

  • インタラクティブ UI を探索: 利用可能なスラッシュコマンドは /help と入力して確認してください。
  • エージェント型コーディングを試す: CLI に自然言語を使用してコードのリファクタリング、ファイルの説明、またはタスクの自動化を依頼してみてください。
  • モデルを設定: /model を使用して Qwen3-Coder またはその他のサポートされているバックエンド(ローカルの Ollama を含む)を選択できます。
  • VS Code と統合: シームレスなエディター統合のために Qwen Code Companion 拡張機能をインストールしてください。
  • 設定をカスタマイズ: ~/.qwen/settings.json を編集してテーマ、デフォルトモデル、および高度なオプションを設定できます。

これで、ターミナル内で強力な AI ペアプログラマーとして Qwen Code CLI を使用する準備が整いました。プロジェクトフォルダ内で「このコードベースを説明して」や「この関数のパフォーマンスを向上させるためにリファクタリングして」などの簡単なプロンプトから始めてみましょう。

コーディングを楽しんでください!

Share this article

Referenced Tools

Browse entries that are adjacent to the topics covered in this article.

Explore directory
GitHub Copilot Coding Agent logo

GitHub Copilot Coding Agent

MCP Servers

GitHub Copilot Coding Agent, now documented as Copilot cloud agent, is GitHub's asynchronous software development agent for researching repositories, planning changes, editing code on branches, and opening pull requests for review. It runs in a GitHub Actions-powered environment and can be started from GitHub, supported IDEs, GitHub CLI, the REST API, integrations, or the GitHub MCP Server.

OpenCode MCP logo

OpenCode MCP

MCP Servers

OpenCode is an open-source AI coding agent with MCP client support. It can connect to local and remote MCP servers and expose their tools to the LLM alongside built-in OpenCode tools.

Weibo Open Platform CLI logo

Weibo Open Platform CLI

MCP Servers

Weibo Open Platform CLI is the official CLI service page for using Weibo Open Platform capabilities from command-line and agent-oriented workflows. Public, parseable MCP server transport and client setup details were not available at verification time.

Agent Reach logo

Agent Reach

MCP Servers

Agent Reach is an open-source CLI and Agent Skill that installs, routes, and health-checks upstream tools for web, social, GitHub, video transcript, RSS, and search access. It is not documented as a standalone MCP server; some channels use MCP-backed upstream tools such as mcporter/Exa, xiaohongshu-mcp, and linkedin-scraper-mcp.

Gemini CLI MCP logo

Gemini CLI MCP

Clients & Apps

Gemini CLI is an open-source terminal AI agent with MCP client support. It connects to configured MCP servers over stdio, SSE, or Streamable HTTP to extend Gemini with external tools, resources, and prompts.

vercel eve logo

vercel eve

MCP Servers

Vercel Eve is an open-source, filesystem-first TypeScript framework for building durable AI agents on Vercel. It organizes agent capabilities as files for instructions, tools, skills, channels, schedules, subagents, and connections, including integrations with external MCP and OpenAPI tools.