【Ubuntu】Node.jsを更新してGemini CLIをインストール!手順を解説

普段使っているターミナルから離れずにAIにサクッと質問できたら便利だな、と思いGemini CLIをインストールしてみました。 インストール要件を調べるとNode.js v20以降が必要とのこと。そこで、最新LTS版であるv22をインストールすることにしました。ただ、Ubuntu標準のNode.jsはバージョンが古いため、リポジトリを追加してバージョンアップする必要がありました。 今回はその手順をブログに残しておきます。 手順1:古いNode.jsのアンインストール まず、競合を避けるために、Ubuntuに標準で入っている古いNode.jsをアンインストールしておきましょう。 あわせて sudo apt autoremove を実行して、不要な依存パッケージも掃除しておくとクリーンな状態になります。 手順2:NodeSourceリポジトリの追加 Node.jsの最新版は、NodeSourceというリポジトリからインストールするのが一般的です。公式サイトの手順はこちらです: https://nodesource.com/products/distributions リポジトリ追加用のスクリプトをダウンロードするために、curlコマンドを使います。入っていない場合は、先にインストールしておきましょう。 続いて、curlでセットアップスクリプトを実行し、Node.js v22のリポジトリをシステムに追加します。 手順3:Node.js v22のインストール リポジトリの準備ができたので、aptコマンドでNode.js v22をインストールします。 インストール後、node -v コマンドを打って、バージョンが “v22” で始まっていれば成功です。 手順4:Gemini CLIのインストール いよいよGemini CLI本体をインストールします。npmを使い、グローバル(-g)にイン ストールするためsudoを付けて実行します。 最後に – 使ってみた感想 これまでは、AIにちょっとしたことを聞きたいだけでも、いちいちブラウザに移動するのが地味にストレスでした。Gemini CLIを導入してからは、そのストレスから解放され、すべての作業がターミナル上で完結するようになり、とても快適になりました。返答がターミナルに表示されるだけでなく、テキストファイルとして出力してもらうこともできるので、ブラウザ上のチャットAIを使用するよりも便利です。

How to Install the Gemini CLI on Ubuntu by Upgrading Node.js

I installed the Gemini CLI because I want to ask an AI questions without leaving my terminal. The installation requires Node.js v20 or newer, so I chose to install version 22, as it is the latest Long-Term Support (LTS) release, ensuring stability. Since the Node.js version in Ubuntu’s official repository is older, I had to add a new repository to install it. Here are the detailed steps I took to get it working: 1. Remove the old Node.js version First, you need to remove the outdated Node.js package that was installed from Ubuntu’s default repositories. Running sudo apt autoremove afterward is also a good idea to clean up any leftover … Read more

Studying Vim

You Can Execute Terminal Commands in Vim I’m currently working through Vim lessons, from the beginning up to lesson 5.1. I discovered that you can execute terminal commands directly within Vim—for example, using :!ls to list files.

Daily Vim Training

Practice Vim Today I practiced Vim using vimtutor, covering lessons from the beginning through Lesson 3.2. I reviewed basic movement keys, editing commands, and started understanding how operators and text objects work. It’s starting to feel more intuitive!

Vimで大文字の「U」を押しても何も起こらない現象及びその原因

Vimにおける「U」アンドゥコマンドの挙動について カーソルを別の行に移動すると「U」の挙動が変わる Vimtutorのアンドゥに関するレッスンで練習していたとき、「U」を押しても何も起こらないことがあり、困惑しました。調べてみると、「U」コマンドは、カーソルがその行に移動してから行った変更のみを元に戻すことがわかりました。 つまり、誤って「j」や「k」を押して別の行に移動し、すぐに戻ってきた場合でも、「U」は期待通りに動作しません。カーソルが一度でもその行を離れると、変更履歴がリセットされてしまうのです。 慎重なタイピングを心がけることで、「U」が意図通りに動作するようになります。Vimの操作に慣れていくことで、こうした問題に遭遇することも少なくなるでしょう。

Understanding the “U” Undo Command in Vim

Understanding the “U” Undo Command in Vim Moving the Cursor to Another Line Breaks “U”‘s Behavior While practicing in Vimtutor‘s Undo lesson, I ran into a confusing issue: sometimes pressing “U” didn’t do anything. After some research, I learned that the “U” command only undoes changes made on the current line since the cursor moved to it. This means if you accidentally press “j” or “k” and move to another line—even briefly—then return, “U” won’t work as expected. It forgets the changes because the cursor left the line. Careful typing helps ensure “U” behaves as intended. As I continue learning Vim controls, I expect to encounter these problems less often.

How to Use Symbols with IME on Android Smartphones

You Can Access Major Symbols by Long-Pressing “.” in Gboard I used to worry about how to input symbols like “?” and “”” on my Android smartphone. After doing some research, I found that in Gboard, you can access many major symbols by long-pressing the period key (“.”). For example, long-pressing “.” gives you options like “?” and “””. Now, I feel much more comfortable typing in English!