homebrew brew doctorトラブルシューティング

Snow LeopardからLion にアップグレードしたついでにbrew doctorしてみたらWarningのオンパレード。せっかくなのでトラブルシューティングをまとめました。
brewが表示してくれる通りに対処すればいいので、めんどくさいだけで難しくはない。


■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■

Warning: Your Homebrew is outdated
You haven't updated for at least 24 hours, this is a long time in brewland!

原因:
Homebrewアップデートしてね

対処法
brew update コマンドでHomebrewのアップデート

brew update

-- 実行結果
me-no-MacBook-Air:~ hazu$ brew update
Updated Homebrew from 2e65c804 to fe41fa14.
==> New Formulae
chordii	     isl	  rtf2latex2e
==> Updated Formulae
akka		      czmq		    gnu-prolog		  libslax		open-mesh	      readosm		    whirr
auto-scaling	      darner		    gnutls		  libspatialite		openvpn		      redis		    wiggle
autoconf-archive      dovecot		    go			  libyaml		parallel	      riemann		    wireshark
bsdconv		      duply		    groonga		  lighttpd		pari		      root		    xmlrpc-c
cairo		      ec2-api-tools	    guile		  mathomatic		parrot		      ruby-build	    xrootd
cassandra	      elixir		    hadoop		  metaproxy		pgbouncer	      scala		    yaz
cdo		      erlang		    haproxy		  monetdb		pianobar	      spatialite-gui	    yazpp
cfengine	      findutils		    help2man		  mongodb		pure		      spatialite-tools	    yeti
class-dump	      fish		    icu4c		  mpich2		pygtk		      spin		    ykpers
clhep		      fox		    iso-codes		  nagios		python		      swi-prolog	    youtube-dl
cloog		      freeimage		    jenkins		  newlisp		python3		      the_silver_searcher
concurrencykit	      geoserver		    jruby		  nginx			qemu		      tomcat
css-crush	      gforth		    juise		  nmap			rakudo-star	      vim
curl		      glm		    librasterlite	  node			rasqal		      vtk
==> Deleted Formulae
vimeo-downloader


■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■

Warning: Your XQuartz (2.6.2) is outdated
Please install XQuartz 2.7.4.

原因:
XQuartzがないよ

対処法
XQuartzをインストール
http://xquartz.macosforge.org/landing/から、XQuartz-2.7.4.dmg をダウンロードしてインストールする


■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■

Warning: Experimental support for using Xcode without the "Command Line Tools".
You have only installed Xcode. If stuff is not building, try installing the
"Command Line Tools for Xcode" package provided by Apple.

原因:
Xcodeのコマンドラインツールがインストールされていない

対処法
Finder アプリケーションフォルダ > Xcodeを開く > ヘッドバーのXcode > Preferences... > Downloads > Command Line Toolsをインストール


■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■

Warning: You have leftover files from an older version of Xcode.
You should delete them using:
  /Developer/Library/uninstall-developer-folder

原因:
古いバージョンのXcodeが存在する

対処法
コマンドラインから、下記コマンドを実行して削除する

sudo /Developer/Library/uninstall-developer-folder

-- 実行結果
me-no-MacBook-Air:~ hazu$ sudo /Developer/Library/uninstall-developer-folder
Password:
パスワード入力
Use of uninitialized value $pkgutil_volume_basename in concatenation (.) or string at /Developer/Library/uninstall-developer-folder line 35.
Start time: 2012年 12月 6日 木曜日 00時07分52秒 JST
Analyzing devtools package: 'com.apple.pkg.ApplicationLoaderLeo'...
Analyzing devtools package: 'com.apple.pkg.DashcodeLeo'...
Analyzing devtools package: 'com.apple.pkg.DevDocumentationLeo'...
Analyzing devtools package: 'com.apple.pkg.DevSamplesLeo'...
Analyzing devtools package: 'com.apple.pkg.DevToolsDocumentationLeo'...
Analyzing devtools package: 'com.apple.pkg.DeveloperDiskImage4_3'...
Analyzing devtools package: 'com.apple.pkg.DeveloperDiskImageReleased'...
Analyzing devtools package: 'com.apple.pkg.DeveloperToolsCLILeo'...
Analyzing devtools package: 'com.apple.pkg.DeveloperToolsLeo'...
Analyzing devtools package: 'com.apple.pkg.MacOSX10.5Leo'...
Analyzing devtools package: 'com.apple.pkg.MacOSX10.6Leo'...
Analyzing devtools package: 'com.apple.pkg.MacOSXSupportPluginLeo'...
Analyzing devtools package: 'com.apple.pkg.OpenGLAppsLeo'...
Analyzing devtools package: 'com.apple.pkg.OtherDevDocumentationLeo'...
Analyzing devtools package: 'com.apple.pkg.X11DocumentationLeo'...
Analyzing devtools package: 'com.apple.pkg.clangLeo'...
Analyzing devtools package: 'com.apple.pkg.gcc4.0ADCDocsLeo'...
Analyzing devtools package: 'com.apple.pkg.gcc4.0Leo'...
Analyzing devtools package: 'com.apple.pkg.gcc4.2ADCDocsLeo'...
Analyzing devtools package: 'com.apple.pkg.gcc4.2Leo'...
Analyzing devtools package: 'com.apple.pkg.iPhoneDocumentation'...
Analyzing devtools package: 'com.apple.pkg.iPhoneHostSideTools'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDK3_0'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDK3_1'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDK3_1_2'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDK3_1_3'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDK3_2'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDK4_0'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDK4_1'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDK4_2'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDK4_3'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDKSnowLeopardExtras'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDKTools'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSimulatorSDK3_2'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSimulatorSDK4_0'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSimulatorSDK4_1'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSimulatorSDK4_2'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSimulatorSDK4_3'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSimulatorSDKTools'...
Analyzing devtools package: 'com.apple.pkg.llvm-gcc4.2Leo'...
Removing devtools files...
Removing generated files...
Removing Xcode Caches...
find: /var/folders/d6/v8phdwn950n0jgr9rn10__4m0000gn/C/com.apple.DeveloperTools: No such file or directory
Removing Xcode Documentation...
Removing empty devtools directories...
Finish time: 2012年 12月 6日 木曜日 00時15分38秒 JST


■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■

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:

    byobu
    gnu-sed
    pidof
    python
    xz

原因:
link切れてるよ

対処法
brew linkコマンドでlinkを貼り直す

brew link app名

-- 実行結果
me-no-MacBook-Air:~ me$ brew link byobu
Linking /usr/local/Cellar/byobu/3.28... 77 symlinks created
me-no-MacBook-Air:~ me$ brew link gnu-sed
Linking /usr/local/Cellar/gnu-sed/4.2.1... 2 symlinks created
me-no-MacBook-Air:~ me$ brew link pidof
Linking /usr/local/Cellar/pidof/0.1.4... 0 symlinks created
me-no-MacBook-Air:~ me$ brew link python
Linking /usr/local/Cellar/python/2.7.2... 
4711 symlinks created
me-no-MacBook-Air:~ me$ brew link xz
Linking /usr/local/Cellar/xz/5.0.4... 53 symlinks created


■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■

Warning: Some installed formula are missing dependencies.
You should `brew install` the missing dependencies:

    brew install bsdmake coreutils fontconfig pcre

Run `brew missing` for more details.

原因:
依存ツールファイルがないよ

対処法
表示されたコマンドを打って
依存ツールファイルをインストール

brew install bsdmake coreutils fontconfig pcre

-- 実行結果
me-no-MacBook-Air:~ me$ brew install bsdmake coreutils fontconfig pcre
==> Downloading http://opensource.apple.com/tarballs/bsdmake/bsdmake-24.tar.gz
######################################################################## 100.0%
==> Downloading patches
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
==> Patching
patching file Makefile.dist
patching file mk/bsd.README
patching file mk/bsd.cpu.mk
patching file mk/bsd.doc.mk
patching file mk/bsd.obj.mk
patching file mk/bsd.own.mk
patching file mk/bsd.port.mk
patching file mk/bsd.port.subdir.mk
patching file mk/sys.mk
patching file pathnames.h
patching file dir.c
patching file dir.h
patching file main.c
==> make -f Makefile.dist
/usr/local/Cellar/bsdmake/24: 31 files, 336K, built in 12 seconds
==> Downloading http://ftpmirror.gnu.org/coreutils/coreutils-8.20.tar.xz
######################################################################## 100.0%
==> Patching
patching file Makefile.in
==> ./configure --prefix=/usr/local/Cellar/coreutils/8.20 --program-prefix=g
==> make install
==> Caveats
All commands have been installed with the prefix 'g'.

If you really need to use these commands with their normal names, you
can add a "gnubin" directory to your PATH from your bashrc like:

    PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"

Additionally, you can access their man pages with normal names if you add
the "gnuman" directory to your MANPATH from your bashrc as well:

    MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"

==> Summary
/usr/local/Cellar/coreutils/8.20: 208 files, 9.4M, built in 3.8 minutes
==> Downloading http://fontconfig.org/release/fontconfig-2.10.1.tar.gz
Already downloaded: /Library/Caches/Homebrew/fontconfig-2.10.1.tar.gz
==> Patching
patching file src/fcarch.h
==> ./configure --with-add-fonts=/Library/Fonts,~/Library/Fonts --prefix=/usr/local/Cellar/fontconfig/2.10.1
==> make install
/usr/local/Cellar/fontconfig/2.10.1: 439 files, 5.6M, built in 88 seconds
==> Downloading ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.31.tar.bz2
######################################################################## 100.0%
######################################################################## 100.0%==> ./configure --prefix=/usr/local/Cellar/pcre/8.31 --enable-utf8 --enable-unicode-properties --enable-pcregrep-libz --enable-pcregrep-libbz2
==> make test
==> make install
/usr/local/Cellar/pcre/8.31: 131 files, 3.2M, built in 97 seconds


■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■

Warning: /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. The following tools exist at both paths:

    2to3
    git
    git-cvsserver
    git-receive-pack
    git-shell
    git-upload-archive
    git-upload-pack
    gitk
    idle
    pgrep
    pkill
    pydoc
    python
    python-config
    python2.7
    python2.7-config
    pythonw
    pythonw2.7
    smtpd.py
    sqlite3

Consider amending your PATH so that /usr/local/bin
occurs before /usr/bin in your PATH.

原因:
パスがちゃんと設定されていない

me-no-MacBook-Air:~ me$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin

!/usr/binが/usr/local/binより前に読み込まれている

対処法
パスを設定し直す

export PATH=/usr/local/bin:$PATH


■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■

me-no-MacBook-Air:~ me$ brew doctor
Your system is raring to brew.

これで完了。
やったー!終わったー!!

■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■