Homebrewの再インストール

macのOS High Sierra に上げた影響なのか、 Homebrew の brew コマンドがうまく動作しなくなりました。

エラーメッセージから事例を探し、いくつかのコマンドを打ち込んでみたが解決しないので、伝家の宝刀を抜くことにします。 そう「再インストール」を実行します。

環境情報

実行手順

まずは、Homebrewをアンインストールします。

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

次に、Homebrewを再度インストールします。

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

brew doctor (1回目)

$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Your Xcode (9.0) is outdated.
Please update to Xcode 9.2 (or delete it).
Xcode can be updated from the App Store.


Warning: Your XQuartz (2.7.5) is outdated.
Please install XQuartz 2.7.11 (or delete the current version).
XQuartz can be updated using Homebrew-Cask by running
  brew cask reinstall xquartz

Xcode が古いよ。というエラーがでたので、 最新版を Mac App Store から入手します。 (サイズが5GB位あるため、ダウンロードに時間が掛かります。)

XQuartz も古いよ。ということなので、 最新版を入手し、インストールします。 https://www.xquartz.org/

You will need to log out and log back in to make XQuartz your default X11 server.

ログアウト->ログインしなさいとのことなので、指示に従います。

brew doctor (2回目)

$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  php55

brew link でリンクを貼ります。

$ brew link php55
Linking /usr/local/Cellar/php55/5.5.12... 0 symlinks created

brew doctor (3回目)

$ brew doctor
Your system is ready to brew.

追記(2017/2/6)
よく調べたら High Sierra からPHPのバージョンが7.1になっているので、
php55 は不要でした。アンインストールしました。

$ brew uninstall php55

以上。