一馬力のメモ帳

MVSからLinuxまで。基盤屋さんは眠らない

Homebrewの再インストール[macOS]

macOS用のパッケージマネージャ
Homebrew(https://brew.sh/index_ja)の調子が怪しいので
再インストールしてみました。

f:id:htbariki:20180324155331p:plain

同じ操作をする人達のために,操作の全ログを公開しておきます

参考にして下さい

目次


アンインストール

アンインストールはターミナルを開いて

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

コマンドで実行します

実行結果に”==> Homebrew uninstalled!”が出力されれば
アンインストールは成功です。

アンインストール実行結果のログ

ichibariki:~ MBPR$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
Warning: This script will remove:
/Users/MBPR/Library/Caches/Homebrew/
/Users/MBPR/Library/Logs/Homebrew/
/usr/local/Cellar/
/usr/local/Homebrew/
/usr/local/Homebrew/.github/
/usr/local/Homebrew/.gitignore
/usr/local/Homebrew/.travis.yml
/usr/local/Homebrew/.yardopts
/usr/local/Homebrew/CODEOFCONDUCT.md
/usr/local/Homebrew/CONTRIBUTING.md
/usr/local/Homebrew/LICENSE.txt
/usr/local/Homebrew/Library/
/usr/local/Homebrew/README.md
/usr/local/Homebrew/bin/brew
/usr/local/Homebrew/completions/
/usr/local/Homebrew/docs/
/usr/local/Homebrew/manpages/
/usr/local/bin/brew -> /usr/local/Homebrew/bin/brew
/usr/local/etc/bash_completion.d/brew -> /usr/local/Homebrew/completions/bash/brew
/usr/local/share/doc/homebrew -> /usr/local/Homebrew/docs
/usr/local/share/man/man1/brew-cask.1 -> /usr/local/Homebrew/manpages/brew-cask.1
/usr/local/share/man/man1/brew.1 -> /usr/local/Homebrew/manpages/brew.1
/usr/local/share/zsh/site-functions/_brew -> /usr/local/Homebrew/completions/zsh/_brew
/usr/local/share/zsh/site-functions/_brew_cask -> /usr/local/Homebrew/completions/zsh/_brew_cask
/usr/local/var/homebrew/locks/update
Are you sure you want to uninstall Homebrew? [y/N] y
==> Removing Homebrew installation...
/usr/local/share/info/dir: Permission denied
/usr/local/share/info/dir: Permission denied
/usr/local/share/info/dir: Permission denied
/usr/local/share/info/dir: Permission denied
==> Removing empty directories...
==> /usr/bin/sudo /usr/bin/find /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/var -name .DS_Store -delete
Password:
==> /usr/bin/sudo /usr/bin/find /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/var -depth -type d -empty -exec rmdir {} ;
==> Homebrew uninstalled!
The following possible Homebrew files were not deleted:
/usr/local/bin/
/usr/local/etc/
/usr/local/git/
/usr/local/include/
/usr/local/lib/
/usr/local/libexec/
/usr/local/man/
/usr/local/share/
/usr/local/var/
You may wish to remove them yourself.
ichibariki:~ MBPR$

インストール

インストールはHomebrewのページ(https://brew.sh/index_ja)の通りに
ターミナルを開き

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

コマンドで実行します。

実行結果に”==> Installation successful!”が出力されている事を確認しましょう

インストール実行結果のログ

ichibariki:~ MBPR$ /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
==> The following new directories will be created:
/usr/local/Cellar
/usr/local/Homebrew
/usr/local/Frameworks
/usr/local/opt
/usr/local/sbin
/usr/local/share/zsh
/usr/local/share/zsh/site-functions

Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/mkdir -p /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/opt /usr/local/sbin /usr/local/share/zsh /usr/local/share/zsh/site-functions
Password:
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/opt /usr/local/sbin /usr/local/share/zsh /usr/local/share/zsh/site-functions
==> /usr/bin/sudo /bin/chmod 755 /usr/local/share/zsh /usr/local/share/zsh/site-functions
==> /usr/bin/sudo /usr/sbin/chown MBPR /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/opt /usr/local/sbin /usr/local/share/zsh /usr/local/share/zsh/site-functions
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/opt /usr/local/sbin /usr/local/share/zsh /usr/local/share/zsh/site-functions
==> /usr/bin/sudo /bin/mkdir -p /Users/MBPR/Library/Caches/Homebrew
==> /usr/bin/sudo /bin/chmod g+rwx /Users/MBPR/Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown MBPR /Users/MBPR/Library/Caches/Homebrew
==> /usr/bin/sudo /bin/mkdir -p /Library/Caches/Homebrew
==> /usr/bin/sudo /bin/chmod g+rwx /Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown MBPR /Library/Caches/Homebrew
==> Downloading and installing Homebrew...
remote: Counting objects: 4244, done.
remote: Compressing objects: 100% (2798/2798), done.
remote: Total 4244 (delta 2186), reused 2737 (delta 1298), pack-reused 0
Receiving objects: 100% (4244/4244), 2.44 MiB | 129.00 KiB/s, done.
Resolving deltas: 100% (2186/2186), done.
From https://github.com/Homebrew/brew
 * [new branch]      master     -> origin/master
 * [new tag]         0.1        -> 0.1
 * [new tag]         0.2        -> 0.2
 * [new tag]         0.3        -> 0.3
 * [new tag]         0.4        -> 0.4
 * [new tag]         0.5        -> 0.5
 * [new tag]         0.6        -> 0.6
 * [new tag]         0.7        -> 0.7
 * [new tag]         0.7.1      -> 0.7.1
 * [new tag]         0.8        -> 0.8
 * [new tag]         0.8.1      -> 0.8.1
 * [new tag]         0.9        -> 0.9
 * [new tag]         0.9.1      -> 0.9.1
 * [new tag]         0.9.2      -> 0.9.2
 * [new tag]         0.9.3      -> 0.9.3
 * [new tag]         0.9.4      -> 0.9.4
 * [new tag]         0.9.5      -> 0.9.5
 * [new tag]         0.9.8      -> 0.9.8
 * [new tag]         0.9.9      -> 0.9.9
 * [new tag]         1.0.0      -> 1.0.0
 * [new tag]         1.0.1      -> 1.0.1
 * [new tag]         1.0.2      -> 1.0.2
 * [new tag]         1.0.3      -> 1.0.3
 * [new tag]         1.0.4      -> 1.0.4
 * [new tag]         1.0.5      -> 1.0.5
 * [new tag]         1.0.6      -> 1.0.6
 * [new tag]         1.0.7      -> 1.0.7
 * [new tag]         1.0.8      -> 1.0.8
 * [new tag]         1.0.9      -> 1.0.9
 * [new tag]         1.1.0      -> 1.1.0
 * [new tag]         1.1.1      -> 1.1.1
 * [new tag]         1.1.2      -> 1.1.2
 * [new tag]         1.1.3      -> 1.1.3
 * [new tag]         1.1.4      -> 1.1.4
 * [new tag]         1.1.5      -> 1.1.5
HEAD is now at 8b04545 Merge pull request #1667 from jmorten/bugfix/typo
==> Tapping homebrew/core
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
remote: Counting objects: 3788, done.
remote: Compressing objects: 100% (3670/3670), done.
remote: Total 3788 (delta 19), reused 321 (delta 6), pack-reused 0
Receiving objects: 100% (3788/3788), 3.02 MiB | 31.00 KiB/s, done.
Resolving deltas: 100% (19/19), done.
Tapped 3664 formulae (3,817 files, 9.4M)
==> Cleaning up /Library/Caches/Homebrew...
==> Migrating /Library/Caches/Homebrew to /Users/MBPR/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://git.io/brew-analytics

==> Next steps:
- Run `brew help` to get started
- Further documentation:
https://git.io/brew-docs
ichibariki:~ MBPR$

Homebrew動作の確認

インストールが完了したら
動作確認してみましょう。

brew help

まずはhelpコマンドが動くか確認

コマンドは

 brew help

です。

brew helpの実行結果

ichibariki:~ MBPR$
ichibariki:~ MBPR$ brew help
Example usage:
  brew search [TEXT|/REGEX/]
  brew (info|home|options) [FORMULA...]
  brew install FORMULA...
  brew update
  brew upgrade [FORMULA...]
  brew uninstall FORMULA...
  brew list [FORMULA...]

Troubleshooting:
  brew config
  brew doctor
  brew install -vd FORMULA

Developers:
  brew create [URL [--no-fetch]]
  brew edit [FORMULA...]
https://github.com/Homebrew/brew/blob/master/docs/Formula-Cookbook.md

Further help:
  man brew
  brew help [COMMAND]
  brew home
ichibariki:~ MBPR$

brew -v

続いてバージョンの確認
コマンドは

  brew -v

※[参考]2018.1時点の最新版は1.5系です。

brew -vの実行結果

ichibariki:~ MBPR$ brew -v
Homebrew 1.1.5
Homebrew/homebrew-core (git revision 16f4; last commit 2016-12-17)
ichibariki:~ MBPR$

brew doctor

続いてbrewの健康診断
コマンドは

 brew doctor

実行結果に”Your system is ready to brew.”と出力されれば
Homebrewは健康です。

brew doctorの実行結果

ichibariki:~ MBPR$ brew doctor
Your system is ready to brew.

参考になれば幸いです。

試した環境

ホストOS

2500/15.4 MJLT2J/A MacBook Pro Retinaディスプレイ

MacBook Pro (Retina, 13-inch, Late 2013)
macOS Sierra
 システムのバージョン:    macOS 10.12 (16A323)
 カーネルのバージョン:    Darwin 16.0.0

スポンサーリンク