Homebrewの仕組み
Homebrewは、Macシステムには用意されていないパッケージをインストールする時によく使う管理ツールの一つです。
Macシステムにパッケージのインストールやアンインストールなどを一元的に管理するものです。パッケージやライブラリの依存関係などが管理できます。
Homebrewは、個別のディレクトリにパッケージをインストールし、それらへのシンボリックリンクを/usr/localに作ります。
Homebrewのインストール
以下のスクリプトをMacのターミナルに貼り付け実行します。
# インストール
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# インストール結果
Tapped 2 commands and 4723 formulae (4,982 files, 12.3MB).
Already up-to-date.
==> Installation successful!
==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
https://docs.brew.sh/Analytics
==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
https://github.com/Homebrew/brew#donations
==> Next steps:
- Run `brew help` to get started
- Further documentation:
https://docs.brew.sh
インストールされたHomebrewの場所は以下で確認してみます。
ls /usr/local/Homebrew/
# 結果
CHANGELOG.md LICENSE.txt completions
CODE_OF_CONDUCT.md Library docs
CONTRIBUTING.md README.md manpages
Dockerfile azure-pipelines.yml
Dockerfile.test.yml bin
Homebrew使い方
Homebrewを使ってwgetをインストールすることを通して、Homebrewの使い方を説明してみます。
# インストール
brew install wget
# 結果
==> Installing dependencies for wget: gettext, libunistring, libidn2 and openssl
==> Installing wget dependency: gettext
==> Downloading https://homebrew.bintray.com/bottles/gettext-0.19.8.1.mojave.bot
######################################################################## 100.0%
......
wgetの置き場所とシンポリックを確認します。
ls -la /usr/local/bin/wget
# 表示
lrwxr-xr-x 1 usernane groupname 32 2 20 14:55 /usr/local/bin/wget -> ../Cellar/wget/1.20.1_4/bin/wget