Google Gemini CLI の使い方:npm/brew インストール、Google ログイン、@ ファイル

Gemini CLI を入れ、Google ログインし、@ 参照で最初のターミナル Agent プロンプトを試す。

初めて Google Gemini CLI を端末で動かすとき、止まるのはプロンプトより Node.js、PATH 上の gemini、Google ログイン未完了のことが多い。公式 README と geminicli.com/docs どおりに入れ、プロジェクトでログインし、最初のプロンプトで @ によりファイル文脈を渡す。

検索語は Google Gemini CLI インストールと @ ファイル. This page follows google-gemini/gemini-cli install and auth notes plus the file-management tutorial for @ references. It is Google’s terminal agent, not this site’s meeting product. For a short huddle to review a diff, open a room on wbmeet; see how to create and join a room.

CLI を入れるGoogle ログイン@ ファイルと最初のプロンプト

Gemini CLI が向く人

Gemini CLI is an open-source (Apache 2.0) terminal-first agent: read repos, edit files, run shell, optional Google Search grounding. Many developers use Sign in with Google (OAuth); the README documents free-tier limits for personal accounts (see cloud.google.com/gemini/docs/quotas). Alternatives: GEMINI_API_KEY from AI Studio or Vertex AI for enterprise.

npm / brew
Common install paths
@ path
Force file context
OAuth / key
Google account or API key

Install with npm or Homebrew

  1. 1

    Prepare Node.js

    npm install needs a supported Node.js (see the official installation page). Confirm node -v and npm -v. Restricted environments can use the README conda + nodejs recipe.

  2. 2

    Global install or npx

    npm install -g @google/gemini-cli. macOS/Linux: brew install gemini-cli. No global install: npx @google/gemini-cli. Channels: @latest, @preview, @nightly per Release Channels in the README.

  3. 3

    Verify the command

    New terminal: gemini --version. If command not found, add npm’s global bin directory to PATH.

Sign in with Google (or API key)

  1. 1

    Start from the project directory

    cd into your repo and run gemini. Choose Sign in with Google and finish OAuth in the browser.

  2. 2

    Code Assist license (optional)

    For org Gemini Code Assist, README suggests export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID" before gemini.

  3. 3

    API key path (optional)

    Create a key at aistudio.google.com/apikey, then export GEMINI_API_KEY="YOUR_API_KEY". Never commit keys to Git.

First prompt and @ file context

  1. 1

    Force-read with @

    Official file-management tutorial: @src/foo.ts reads the file immediately and injects it. Example: @src/utils/helpers.ts Explain what each export does.

  2. 2

    Multiple files and folders

    Chain references: @src/A.tsx @src/types/User.ts. Whole folder: @src/utils/ (large folders use more tokens—prefer named files first).

  3. 3

    One reviewable task

    Follow with a diff-friendly ask: fix one typo in @README.md and show the unified diff before writing. Approve small edits only in hour one.

# First hour · Gemini CLI · 2026-09
npm install -g @google/gemini-cli
# or: brew install gemini-cli
gemini --version
cd /path/to/your/repo
gemini
# Sign in with Google
@src/main.ts Summarize the entry point and list public exports.
@src/main.ts Add one-line JSDoc to the main export; show diff before writing.

Install vs auth

PathGood forFirst-hour note
npm globalCross-platform daily usePATH includes npm global bin
HomebrewmacOS / Linuxbrew upgrade gemini-cli
npxZero-install trialSlower each run
Google OAuthIndividual devsCheck official quotas page
GEMINI_API_KEYModel/billing controlKeys stay out of Git
01

gemini not found

Check npm global path and open a new terminal. npx isolates PATH issues.

02

Browser login stuck

Copy the OAuth URL from the terminal; check browser and proxy settings.

03

Wrong @ path

Paths resolve from the current working directory; confirm you are at the repo root.

Official path: install Gemini CLI → Google sign-in or API key → use @file for context → small change with reviewed diff. Trust geminicli.com/docs and your installed version.

Vs other terminal agents
Commands and auth differ per vendor; you can keep several CLIs. See our Claude Code install note for comparison.
What is GEMINI.md?
Project-level context file supported by the CLI—configure after you are comfortable with @ references.
Not a meeting-product guide
Only Gemini CLI’s first hour. Short whiteboard call: wbmeet.

まだ確認したいこと

Homebrew は必須か。

いいえ。npm グローバルが README の主経路。macOS/Linux は brew install gemini-cli も可。

無料 Google アカウントで足りるか。

個人 OAuth には公式 quotas ページの無料枠とレート制限がある。超える場合は API キーや有料。

@ ファイルとディレクトリの違いは。

単一ファイル @ は正確でトークン節約。@ディレクトリ は広い質問向けだがコスト大。最初は 1–2 ファイル。

確認なしで書き込むか。

公式は unified diff を強調。最初の一時間は小さな変更だけ承認。

無料で会議を開始