Homebrewのインストール

インストールは公式サイトにあるコマンドを叩けばOK。

1
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

コマンドライン・デベロッパー・ツールをインストールしていない場合は、インストールが促されるのでOKを押す。
パスワードを求められるので入力すれば完了。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
==> The following directories will be made group writable:
/usr/local/.
==> The following directories will have their owner set to lab3-34:
/usr/local/.
==> The following directories will have their group set to admin:
/usr/local/.
Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/.
WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.
To proceed, enter your password, or type Ctrl-C to abort.
Password:
==> /usr/bin/sudo /usr/sbin/chown lab3-34 /usr/local/.
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/.
==> /usr/bin/sudo /bin/mkdir /Library/Caches/Homebrew
==> /usr/bin/sudo /bin/chmod g+rwx /Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown lab3-34 /Library/Caches/Homebrew
==> Downloading and installing Homebrew...
remote: Counting objects: 456, done.
remote: Compressing objects: 100% (413/413), done.
remote: Total 456 (delta 26), reused 312 (delta 17), pack-reused 0
Receiving objects: 100% (456/456), 694.24 KiB | 207.00 KiB/s, done.
Resolving deltas: 100% (26/26), done.
From https://github.com/Homebrew/brew
* [new branch] master -> origin/master
HEAD is now at d5085ed curl: fall back to /usr/bin/curl when HOMEBREW_CURL doesn't exist
==> Tapping homebrew/core
Cloning into '/usr/local/Library/Taps/homebrew/homebrew-core'...
remote: Counting objects: 3656, done.
remote: Compressing objects: 100% (3539/3539), done.
remote: Total 3656 (delta 14), reused 1566 (delta 5), pack-reused 0
Receiving objects: 100% (3656/3656), 2.70 MiB | 68.00 KiB/s, done.
Resolving deltas: 100% (14/14), done.
Checking connectivity... done.
Tapped 3531 formulae (3,682 files, 8.5M)
==> Installation successful!
==> Next steps
Run `brew help` to get started

こんな感じでインストール完了。
とりあえずセルフチェックしてみる。

1
2
$ brew doctor
Your system is ready to brew.

brewコマンドが叩けて、チェックも問題ないので完了。

もし、brewコマンドが使えなかったらパスが通ってないかもしれないので、次のようにしてみてください。

・環境変数の確認

1
$ echo $PATH

・結果(例)

1
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

「/usr/local/bin」がなかったら次のコマンドを実行

1
2
$ echo export PATH='/usr/local/bin:$PATH' >> ~/.zshrc
source ~/.zshrc

※bash等の場合は適宜変更してください