3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【2025年06月版】iPhoneでGemini CLI (iSH) を使う時とか、SSH等、ブラウザアクセスができない CLI での Gemini CLI の認証をする方法

Last updated at Posted at 2025-06-27

はじめに

iPhoneでiSHや、AndroidのTerminalや、SSHアクセスなどの、CLIのみの環境で、Gemin CLI の認証を行う方法のメモ
たとえば、iPhoneのiSHで、Claude Code や、Gemini CLI を操作する時。

image.png

Claude Code などは標準でCLIでの認証方法を示してくれるが、今のところ、Gemini CLI はそのようではなさそう。

認証方法

  1. SSH等でアクセス
      
  2. Gemini CLI のインストール
    npm install -g @google/gemini-cli
    
      
  3. Gemini CLI の起動 --debug オプションが必要
    gemini --debug
    
      
  4. 表示されるURLをコピー
    • このようなアドレス形式
      Code Assist login required.
      Attempting to open authentication page in your browser.
      Otherwise navigate to:
      
      https://accounts.google.com/o/oauth2/v2/auth?redirect_uri=...
      
      Waiting for authentication...
      Clearcut response:  { nextRequestWaitMs: 900000 }  
      
        
  5. Safari 等ブラウザでコピーしたURLを開いて、Googleアカウントでログインする
    image.png
      
  6. コールバックURLがブラウザのアドレスに表示されるのでコピー
    • このようなアドレス形式
    http://localhost:41171/oauth2callback?state=.....
    
      
  7. iSH等で、SSH等を別で開いて、curl でコピーしたURLを開く
    curl "http://localhost:41171/oauth2callback?state=....."
    
      
  8. 認証完了、geminiが使えるようになる。
    Authenticated via "oauth-personal".
    Flushing log events to Clearcut.
    
      
    image.png

YOLOモードの方法

aliasなどで設定しておくと楽

gemini --yolo

さいごに

かんたんでしたね

リンク

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?