🕌

homebrewで古いバージョンをインストールする

に公開

古いバージョンをインストールしようとして brew install cmake@3 とか試してうまくいかないのを何回もやっている。
正攻法らしきやり方を見つけたのでメモ。

まずは homebrewのリポジトリ を見に行き、 *.rb を探す。
cmake なら https://github.com/Homebrew/homebrew-core/blob/master/Formula/c/cmake.rb

historyを見て、インストールしたいバージョンのコミットを見つける。
cmake

そうしたら、そのバージョンの *.rb をダウンロードし、インストール。

curl -O https://raw.githubusercontent.com/Homebrew/homebrew-core/b4e46db74e74a8c1650b38b1da222284ce1ec5ce/Formula/c/cmake.rb
brew install ./cmake.rb

これでめでたく旧バージョンをインストールできる。

> cmake --version
cmake version 3.31.6

CMake suite maintained and supported by Kitware (kitware.com/cmake).
GitHubで編集を提案

Discussion