一、配置稳定的网络环境
如果下面的gemini 登录认证你选择的方式是通过google网页登录认证的方式的话, 记得开启 Tun 模式
二、查看官方文档
2.1、gemini-API-Key 配置
这个不是必须的,如果下面的gemini 登录认证你选择的方式是通过google网页登录认证的方式,可以跳过这一步,但是采用google网页登录认证的方式,你需要开启“xxx”的“Tun”模式,方便google认证之后的回调
2.2、gemini 安装手册
配置好你本地的node环境
yangjian@yangjiandeMacBook-Pro ~ % sudo n
node/12.22.12
node/16.16.0
node/20.11.1
ο node/21.7.1
Use up/down arrow keys to select a version, return key to install, d to delete, q to quit
copying : node/21.7.1
installed : v21.7.1 (with npm 10.5.0)
安装gemini -cli
yangjian@yangjiandeMacBook-Pro ~ % node -v
v21.7.1
yangjian@yangjiandeMacBook-Pro ~ % npm install -g @google/gemini-cli
yangjian@yangjiandeMacBook-Pro ~ % sudo npm install -g @google/gemini-cli
changed 431 packages in 5s
123 packages are looking for funding
run `npm fund` for details
yangjian@yangjiandeMacBook-Pro ~ %
使用
yangjian@yangjiandeMacBook-Pro ~ % gemini
(node:4510) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
███ █████████ ██████████ ██████ ██████ █████ ██████ █████ █████
░░░███ ███░░░░░███░░███░░░░░█░░██████ ██████ ░░███ ░░██████ ░░███ ░░███
░░░███ ███ ░░░ ░███ █ ░ ░███░█████░███ ░███ ░███░███ ░███ ░███
░░░███ ░███ ░██████ ░███░░███ ░███ ░███ ░███░░███░███ ░███
███░ ░███ █████ ░███░░█ ░███ ░░░ ░███ ░███ ░███ ░░██████ ░███
███░ ░░███ ░░███ ░███ ░ █ ░███ ░███ ░███ ░███ ░░█████ ░███
███░ ░░█████████ ██████████ █████ █████ █████ █████ ░░█████ █████
░░░ ░░░░░░░░░ ░░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░
Tips for getting started:
1. Ask questions, edit files, or run commands.
2. Be specific for the best results.
3. Create GEMINI.md files to customize your interactions with Gemini.
4. /help for more information.
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │
│ Select Auth Method │
│ ● Login with Google │
│ ○ Gemini API Key (AI Studio) │
│ ○ Vertex AI │
│ │
│ Authentication timed out. Please try again. │
│ │
│ (Use Enter to select) │
│ │
│ Terms of Services and Privacy Notice for Gemini CLI │
│ │
│ https://github.com/google-gemini/gemini-cli/blob/main/docs/tos-privacy.md │
│ │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
~ no sandbox (see /docs) gemini-2.5-pro (100% context left)
yangjian@yangjiandeMacBook-Pro ~ % npm install -g @google/gemini-cli
yangjian@yangjiandeMacBook-Pro ~ % sudo npm install -g @google/gemini-cli
changed 431 packages in 5s
123 packages are looking for funding
run `npm fund` for details
yangjian@yangjiandeMacBook-Pro ~ % gemini
(node:4510) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
███ █████████ ██████████ ██████ ██████ █████ ██████ █████ █████
░░░███ ███░░░░░███░░███░░░░░█░░██████ ██████ ░░███ ░░██████ ░░███ ░░███
░░░███ ███ ░░░ ░███ █ ░ ░███░█████░███ ░███ ░███░███ ░███ ░███
░░░███ ░███ ░██████ ░███░░███ ░███ ░███ ░███░░███░███ ░███
███░ ░███ █████ ░███░░█ ░███ ░░░ ░███ ░███ ░███ ░░██████ ░███
███░ ░░███ ░░███ ░███ ░ █ ░███ ░███ ░███ ░███ ░░█████ ░███
███░ ░░█████████ ██████████ █████ █████ █████ █████ ░░█████ █████
░░░ ░░░░░░░░░ ░░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░
Tips for getting started:
1. Ask questions, edit files, or run commands.
2. Be specific for the best results.
3. Create GEMINI.md files to customize your interactions with Gemini.
4. /help for more information.
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ > Type your message or @path/to/file │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
~ no sandbox (see /docs) gemini-2.5-pro (100% context left)| ✖ 1 error (ctrl+o for details)
> /quit
╭─────────────────────────────────╮
│ │
│ Agent powering down. Goodbye! │
│ │
│ │
│ Cumulative Stats (0 Turns) │
│ │
│ Input Tokens 0 │
│ Output Tokens 0 │
│ Thoughts Tokens 0 │
│ ───────────────────────────── │
│ Total Tokens 0 │
│ │
│ Total duration (API) 0s │
│ Total duration (wall) 2m 15s │
│ │
╰─────────────────────────────────╯
yangjian@yangjiandeMacBook-Pro ~ %
评论区