
この記事を書いた人

082P
現在は、システムエンジニアをやっています。得意言語はRubyですが、仕事柄PHPやJavascriptに触れる機会が多いです。記事に関しては、RubyのRuby on Rails、PythonのDjangoなど、Webアプリケーションおよびデータベース系の記事を書くことが多いです。WPFによるアプリ開発もやっていますので、今後はその辺の記事も書ければと思っています。趣味でゲーム配信とボカロPをやってます。既婚者で子供が2人おります。
Command Line Tools for Xcodeのインストール
Homebrewをインストールする前に、Command Line Tools for Xcodeをインストールする必要があります。
もしXcodeをインストールしていない場合は先にXcodeのインストールをお願いします。
「Apple Developer Agreement」にAppleIDでサインイン
「Apple Developer Agreement」にAppleIDでサインインします。
「Command Line Tools for Xcode 16.2 beta 3」をダウンロード

「Command Line Tools for Xcode 16.2 beta 3.dmg」ファイルをダウンロードしてください。
「Command_Line_Tools_for_Xcode_16.2_beta_3」のインストール

ダウンロードされた「Command_Line_Tools_for_Xcode_16.2_beta_3.dmg」ファイルをダブルクリックすると、パッケージファイルが展開されます。
展開された「Command Line Tools.pkg」をダブルクリックしてください。

インストーラが起動します。
「続ける」で次に進んでください。

使用許諾契約の画面が表示されます。
「続ける」で次に進んでください。

「インストール」をクリックするとインストールが始まります。

これで「Command_Line_Tools_for_Xcode_16.2_beta_3」のインストールが終了しました。
「閉じる」をクリックしてインストーラーを終了してください。
Homebrewのインストール
下記のHomebrewページからインストールコードをコピーします。

インストールと書かれている直下にあるコードをコピーします。
ターミナルを起動し、コピーしたコードを貼り付けて実行します。
途中パスワードを聞かれますので、PCのパスワードを入力してEnterキーを押してください。
「Press RETURN/ENTER to continue or any other key to abort:」の状態で一度止まりますので、Enterキーを入力すると、インストールが始まります。
% /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
==> Checking for `sudo` access (which may request your password)...
Password:
==> This script will install:
/opt/homebrew/bin/brew
/opt/homebrew/share/doc/homebrew
/opt/homebrew/share/man/man1/brew.1
/opt/homebrew/share/zsh/site-functions/_brew
/opt/homebrew/etc/bash_completion.d/brew
/opt/homebrew
==> The following new directories will be created:
/opt/homebrew/bin
/opt/homebrew/etc
/opt/homebrew/include
/opt/homebrew/lib
/opt/homebrew/sbin
/opt/homebrew/share
/opt/homebrew/var
/opt/homebrew/opt
/opt/homebrew/share/zsh
/opt/homebrew/share/zsh/site-functions
/opt/homebrew/var/homebrew
/opt/homebrew/var/homebrew/linked
/opt/homebrew/Cellar
/opt/homebrew/Caskroom
/opt/homebrew/Frameworks
Press RETURN/ENTER to continue or any other key to abort:
==> /usr/bin/sudo /usr/bin/install -d -o root -g wheel -m 0755 /opt/homebrew
==> /usr/bin/sudo /bin/mkdir -p /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
・・
==> Downloading and installing Homebrew...
remote: Enumerating objects: 286732, done.
remote: Counting objects: 100% (8379/8379), done.
remote: Compressing objects: 100% (397/397), done.
remote: Total 286732 (delta 8044), reused 8027 (delta 7982), pack-reused 278353 (from 1)
remote: Enumerating objects: 55, done.
remote: Counting objects: 100% (34/34), done.
remote: Total 55 (delta 33), reused 33 (delta 33), pack-reused 21 (from 1)
==> Updating Homebrew...
==> Downloading https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:303bed4c7fc431a685db3c3c151d873740114adbdccd23762ea2d1e39ea78f47
######################################################################### 100.0%
==> Pouring portable-ruby-3.3.6.arm64_big_sur.bottle.tar.gz
Warning: /opt/homebrew/bin is not in your PATH.
Instructions on how to configure your shell for Homebrew
can be found in the 'Next steps' section below.
==> 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
No analytics data has been sent yet (nor will any be during this install run).
==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
https://github.com/Homebrew/brew#donations
==> Next steps:
- Run these commands in your terminal to add Homebrew to your PATH:
echo >> /Users/ユーザー名/.zprofile
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/ユーザー名/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
- Run brew help to get started
- Further documentation:
https://docs.brew.sh
Homebrewにパスを通す
ターミナルに以下のコマンドを入力します。
ユーザー名は、インストール時のターミナル表示最後「Run these commands in your terminal to add Homebrew to your PATH:」の項目にコマンドと一緒に書かれています。
この部分のコマンドをコピーして実行しても構いません。
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/ユーザー名/.zprofile
このコマンドにより、「.zprofile」ファイルに以下の記述が追加されます。
eval "$(/opt/homebrew/bin/brew shellenv)"
Homebrewのバージョン確認
ターミナルを再起動し、以下のコマンドでHomebrewのバージョンが表示されれば、無事インストールは完了です。
brew -v
2024年12月現在のバージョンは「Homebrew 4.4.9」です!
インストール作業、お疲れ様でした!
最後までお読みくださり、ありがとうございました!