前提
環境
- macOS High Sierra
- バージョン 10.13.5
- ターミナルを立ち上げておくこと
Mac本体にインストールされているpythonのバージョンを確認する
- 現状を確認するために下記コマンドを実行
$ python -V
Python 2.7.10
【本題】homebrewをインストールする
インストール先URL

前準備
h_******$ pwd
/Users/h_******
- pwdコマンドを実行し、実行する場所を確認する
- 自分がログインしているユーザー名の直下にいれば問題ない
- もし、ユーザー名の直下にいない場合は、cdコマンドを実行する
- その後、もう一度pwdコマンドを実行する
# 例えば、Desktopにいた場合
:Desktop h_******$ cd
:~ h_******$ pwd
/Users/h_******
homebrewをインストールする
- 前述のサイトに記載されているスクリプトをコピーする
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- コピーしたスクリプトをターミナルに貼り付けて、実行する
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/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
/usr/local/Homebrew
Press RETURN to continue or any other key to abort
- そのまま、enterキーを押す
==> /usr/bin/sudo /bin/mkdir -p /Library/Caches/Homebrew
Password:
- パスワードの入力が求められるので、パスワードを入力する
==> /usr/bin/sudo /bin/chmod g+rwx /Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown h_****** /Library/Caches/Homebrew
==> Downloading and installing Homebrew...
HEAD is now at b7e849799 Merge pull request #4469 from reitermarkus/systemcommand-path
==> Cleaning up /Library/Caches/Homebrew...
==> Migrating /Library/Caches/Homebrew to /Users/h_fukano/Library/Caches/Homebrew...
==> Deleting /Library/Caches/Homebrew...
Already up-to-date.
==> Installation successful!
==> Homebrew has enabled anonymous aggregate user behaviour analytics.
Read the analytics documentation (and how to opt-out) here:
https://docs.brew.sh/Analytics.html
==> Next steps:
- Run `brew help` to get started
- Further documentation:
https://docs.brew.sh
- **Installation successful!**と表示されていれば、正しくインストールされている
- これで、ターミナル上で「brew」から始まるコマンドを実行できるようになった