今回は Homebrew のパッケージについて諸々を調べる方法について。 毎回調べている気がするのでメモしておく。
使った環境は次のとおり。
$ sw_vers ProductName: macOS ProductVersion: 15.4.1 BuildVersion: 24E263 $ uname -srm Darwin 24.4.0 arm64 $ brew --version Homebrew 4.5.2
もくじ
下準備
あらかじめ Homebrew をインストールしておく。 やり方は公式の Web サイト 1 を参照のこと。
基本的な情報を確認する
まずはパッケージの基本的な情報について知りたいときは brew info <package>
を使う。
バージョンやライセンス、Webサイト、インストール用の Ruby スクリプトの場所など色々と確認できる。
$ brew info jq ==> jq: stable 1.7.1 (bottled), HEAD Lightweight and flexible command-line JSON processor https://jqlang.github.io/jq/ Not installed Bottle Size: 525.0KB Installed Size: 1.4MB From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/j/jq.rb License: MIT ==> Dependencies Required: oniguruma ✘ ==> Options --HEAD Install HEAD version ==> Analytics install: 34,169 (30 days), 103,697 (90 days), 519,279 (365 days) install-on-request: 33,728 (30 days), 102,033 (90 days), 511,906 (365 days) build-error: 0 (30 days)
インストール先のディレクトリを確認する
インストールされるディレクトリを確認するには brew --cellar <package>
を使う。
$ brew --cellar jq
/opt/homebrew/Cellar/jq
このコマンドはインストールした後にパッケージに含まれるファイルを使って作業するときにも使うことがある。
パッケージに含まれるファイルを確認する
続いてはインストールした後にパッケージに含まれるファイルを確認する方法について。 まずは調査したいパッケージはインストールしておく。
$ brew install jq
そして brew list -v <package
を実行する。
$ brew list -v jq /opt/homebrew/Cellar/jq/1.7.1/INSTALL_RECEIPT.json /opt/homebrew/Cellar/jq/1.7.1/bin/jq /opt/homebrew/Cellar/jq/1.7.1/.brew/jq.rb /opt/homebrew/Cellar/jq/1.7.1/ChangeLog /opt/homebrew/Cellar/jq/1.7.1/AUTHORS /opt/homebrew/Cellar/jq/1.7.1/NEWS.md /opt/homebrew/Cellar/jq/1.7.1/include/jv.h /opt/homebrew/Cellar/jq/1.7.1/include/jq.h /opt/homebrew/Cellar/jq/1.7.1/sbom.spdx.json /opt/homebrew/Cellar/jq/1.7.1/README.md /opt/homebrew/Cellar/jq/1.7.1/COPYING /opt/homebrew/Cellar/jq/1.7.1/lib/libjq.a /opt/homebrew/Cellar/jq/1.7.1/lib/pkgconfig/libjq.pc /opt/homebrew/Cellar/jq/1.7.1/lib/libjq.dylib /opt/homebrew/Cellar/jq/1.7.1/lib/libjq.1.dylib /opt/homebrew/Cellar/jq/1.7.1/share/man/man1/jq.1 /opt/homebrew/Cellar/jq/1.7.1/share/doc/jq/AUTHORS /opt/homebrew/Cellar/jq/1.7.1/share/doc/jq/NEWS.md /opt/homebrew/Cellar/jq/1.7.1/share/doc/jq/README.md /opt/homebrew/Cellar/jq/1.7.1/share/doc/jq/COPYING
インストールに使われたスクリプトの内容を確認する
インストールしたパッケージは brew cat <package>
でスクリプトの内容を確認できる。
もちろん、先ほど brew info
にあったファイルを確認しても良い。
$ brew cat jq | head class Jq < Formula desc "Lightweight and flexible command-line JSON processor" homepage "https://jqlang.github.io/jq/" url "https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-1.7.1.tar.gz" sha256 "478c9ca129fd2e3443fe27314b455e211e0d8c60bc8ff7df703873deeee580c2" license "MIT" livecheck do url :stable regex(/^(?:jq[._-])?v?(\d+(?:\.\d+)+)$/i)
いじょう。