MacにSQLiteをインストールする
whichしてみると、一応/usr/bin に3.43.2が入っていた。
which sqlite3
/usr/bin/sqlite3
sqlite3 --version
3.43.2 2023-10-10 13:08:14 1b37c146ee9ebb7acd0160c0ab1fd11017a419fa8a3187386ed8cb32b709aapl (64-bit)
Homebrewでインストールしてみる。
brew install sqlite
無事にインストールは完了。

インストールされたパスは /opt/homebrew/Cellar/sqlite/3.46.0/bin/sqlite3

そのシンボリックリンクは、/opt/homebrew/opt/sqlite に設置されていたが、リンク先は古いバージョンのまま。
brew link sqlite3 –force
でリンクを変更する。

しかし、/usr/bin/sqlite3 が先にパスにいる以上は、フルパスで実行しない限りは新しく入れたsqlite3を使えない。
実際、brew link sqlite3 –force を実行したあと、親切なコメントが。
Linking /opt/homebrew/Cellar/sqlite/3.46.0... 8 symlinks created.
If you need to have this software first in your PATH instead consider running:
echo 'export PATH="/opt/homebrew/opt/sqlite/bin:$PATH"' >> ~/.profile
「環境変数のPATHに追加しなさいよ」と教えてくれている。

ついでにこのあと使うかもしれない、sqldiffとsqlite3_analyzerをインストールするため、パッケージ名を検索する。検索は brew -S パッケージ名の一部
その前に、さっきやっておけばよかったのだが brew 自身をアップデートする。
brew update
brew -S sqlite
brew -S sqldiff

パッケージ名がわかったのでそれぞれインストールする。
brew install sqlite-analyzer
brew install sqldiff
インストール先はどちらも、/opt/homebrew/bin/ だった。

で、改めて、/opt/homebrew/bin/ を見てみると、sqlite3もそこにシンボリックリンクがある。

さっきの、パスの話は、/opt/homebrew/opt/sqlite/bin とかではなくて、
/opt/homebrew/bin にさえパスを通して置けば、パッケージ個別にやる必要はないのでは? という考えもある。
これにて完了。