brew doctorがめっちゃ警告してくる
インストールの問題のチェックを行うコマンドである「brew doctor」。
Homebrewでインストールしたパッケージが上手く挙動しなかったので、試しにターミナルに打ち込んでみました。
そしたら大量の警告が出てきて気持ちが悪かったので、一つずつ解決したことを備忘録として残しておきたいと思います。
目指せ、「Your system is ready to brew.」!
まずは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: The following directories are not writable: /usr/local/lib/pkgconfig This can happen if you "sudo make install" software that isn't managed by Homebrew. If a formula tries to write a file to this directory, the install will fail during the link step. You should change the ownership of these directories to your account. sudo chown -R $(whoami) /usr/local/lib/pkgconfig Warning: A newer Command Line Tools release is available. Update them from Software Update in the App Store. 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: libpng freetype glib webp unixodbc mysql pcre jpeg libzip Warning: Homebrew's sbin was not found in your PATH but you have installed formulae that put executables in /usr/local/sbin. Consider setting the PATH for example like so echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.bash_profile Warning: Your Xcode (9.3) is outdated. Please update to Xcode 9.4 (or delete it). Xcode can be updated from the App Store.
めっちゃ警告してきてます。
警告は計5つあるようです。
警告1つ目
Warning: The following directories are not writable: /usr/local/lib/pkgconfig This can happen if you "sudo make install" software that isn't managed by Homebrew. If a formula tries to write a file to this directory, the install will fail during the link step. You should change the ownership of these directories to your account. sudo chown -R $(whoami) /usr/local/lib/pkgconfig
/usr/local/lib/pkgconfigに書き込み権限が無いようです。
「sudo chown -R $(whoami) /usr/local/lib/pkgconfig」で解決できるとのこと。
エラーの解決方法を教えてくれるなんてHome brew優しすぎるぜ…!
$(whoami)は現在ログインしてるusernameにすれば良いです。
僕はここで少しハマりました。
$(whoami) == usernameなのか(whoami) == usernameなのかwhoami == usernameなのかが初見殺しすぎる…
(正解は$(whoami) == username)
警告2つ目
Warning: A newer Command Line Tools release is available. Update them from Software Update in the App Store.
書いてあるまま、App StoreでCommand Line Toolsを更新すれば解決できました。以上。
ソフトウェア自体をアップデートしても構わないみたいです。
エラーの解決方法を教えてくれるなんてHome brew優しs(ry
警告3つ目
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: libpng freetype glib webp unixodbc mysql pcre jpeg libzip
一部のツールがunlinkになっているとのこと。
こちらの警告も書いてあるまま、brew link (ツール名)でずらりと並んでいるツール名を下記のように片っ端から打ち込めば解決。
エr(ry
$ brew link libpng Linking /usr/local/Cellar/libpng/1.6.34... 18 symlinks created $ brew link freetype Linking /usr/local/Cellar/freetype/2.9.1... 8 symlinks created $ brew link glib Linking /usr/local/Cellar/glib/2.56.1... 146 symlinks created $ brew link webp Linking /usr/local/Cellar/webp/1.0.0... 26 symlinks created $ brew link unixodoc Error: No such keg: /usr/local/Cellar/unixodoc $ brew link unixobdc Error: No such keg: /usr/local/Cellar/unixobdc $ brew link unixodbc Linking /usr/local/Cellar/unixodbc/2.3.6... 37 symlinks created $ brew link pcre Linking /usr/local/Cellar/pcre/8.42... 133 symlinks created $ brew link jpeg Linking /usr/local/Cellar/jpeg/9c... 18 symlinks created $ brew link libzip Linking /usr/local/Cellar/libzip/1.5.1... 127 symlinks created
警告4つ目
Warning: Homebrew's sbin was not found in your PATH but you have installed formulae that put executables in /usr/local/sbin. Consider setting the PATH for example like so echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.bash_profile
/usr/local/sbinにpathが通っていないようなので、
$ echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.bash_profile
でpathを通して、
$ source ~/.bash_profile
で変更を反映すればいいみたいです。
警告5つ目
Warning: Your Xcode (9.3) is outdated. Please update to Xcode 9.4 (or delete it). Xcode can be updated from the App Store.
Xcodeのバージョンが古いとのことなので、App StoreでアップデートすればOK。
Xcodeのアップデートに数十分かかったのにはビビりました。
全てのエラーの原因を解決した上で再び「brew doctor」を実行!
$ brew doctor Your system is ready to brew.
ということで警告は全て消え去りました。
スゲーッ爽やかな気分だぜ 新しいパンツをはいたばかりの正月元旦の朝のよーによォ~~~~~~~~~~ッ
これで少しはHome brewの扱いには少し慣れたような気がします。
Home brewのエラーは親切でありがたい限りです。
参考にしたサイト
brew doctorでのWarningを解決してみた(for Mac)
コマンドラインでbrew doctorすると警告だらけになっちゃった助けて
Homebrewのエラーを治す