74
68

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

コマンドラインでbrew doctorすると警告だらけになっちゃった助けて

Posted at

なんかbrew doctorしたら警告だらけになったので1つずつ解決していきます

$ brew doctor
	Warning: Broken symlinks were found. Remove them with `brew prune`:
		/usr/local/bin/c++-4.9
		/usr/local/bin/cpp-4.9
		/usr/local/bin/g++-4.9
  		/usr/local/bin/gcc-4.9
		/usr/local/bin/gcc-ar-4.9
		/usr/local/bin/gcc-nm-4.9
		/usr/local/bin/gcc-ranlib-4.9
		/usr/local/bin/gcov-4.9
		/usr/local/bin/gfortran
		/usr/local/bin/gfortran-4.9
		/usr/local/bin/github
		/usr/local/bin/x86_64-apple-darwin13.2.0-c++-4.9
		/usr/local/bin/x86_64-apple-darwin13.2.0-g++-4.9
		/usr/local/bin/x86_64-apple-darwin13.2.0-gcc-4.9
		/usr/local/bin/x86_64-apple-darwin13.2.0-gcc-4.9.1
		/usr/local/bin/x86_64-apple-darwin13.2.0-gcc-ar-4.9
		/usr/local/bin/x86_64-apple-darwin13.2.0-gcc-nm-4.9
		/usr/local/bin/x86_64-apple-darwin13.2.0-gcc-ranlib-4.9
		/usr/local/bin/x86_64-apple-darwin13.2.0-gfortran-4.9
		/usr/local/lib/gcc/x86_64-apple-darwin13.2.0
		/usr/local/lib/libmpfr.4.dylib
		/usr/local/lib/libmpfr.a
		/usr/local/lib/libmpfr.dylib
		/usr/local/lib/python2.7/site-packages/site-packages
		/usr/local/lib/python3.4/site-packages/site-packages
		/usr/local/share/doc/mpfr
		/usr/local/share/gcc-4.9.1
		/usr/local/share/info/mpfr.info
		/usr/local/share/man/man1/cpp-4.9.1
		/usr/local/share/man/man1/g++-4.9.1
		/usr/local/share/man/man1/gcc-4.9.1
		/usr/local/share/man/man1/gcov-4.9.1
		/usr/local/share/man/man1/gfortran-4.9.1
		/usr/local/share/man/man1/git-lost-found.1
		/usr/local/share/man/man1/git-peek-remote.1
		/usr/local/share/man/man1/git-repo-config.1
		/usr/local/share/man/man1/git-tar-tree.1
		/usr/local/share/man/man7/fsf-funding-4.9.7
		/usr/local/share/man/man7/gfdl-4.9.7
		/usr/local/share/man/man7/gpl-4.9.7
		/usr/local/share/python
		/usr/local/Frameworks/Python.framework/Headers
		/usr/local/Frameworks/Python.framework/Python
		/usr/local/Frameworks/Python.framework/Resources
		/usr/local/Frameworks/Python.framework/Versions/2.7
		/usr/local/Frameworks/Python.framework/Versions/3.4
		/usr/local/Frameworks/Python.framework/Versions/Current
	
	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:
		mpfr
		node_modules
		python
		python3
	
	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:
		
		emacs
		emacsclient
		erb
		etags
		gem
		git
		git-cvsserver
		git-receive-pack
		git-shell
		git-upload-archive
		git-upload-pack
		irb
		rake
		rdoc
		ri
		ruby
		testrb
	
	Consider setting your PATH so that /usr/local/bin
	occurs before /usr/bin. Here is a one-liner:
		echo export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile

問題1: Warning: Broken symlinks were found. Remove them with brew prune:

解決法 #1
このコマンドを打つだけ

$ brew prune 
Pruned 47 symbolic links and 19 directories from /usr/local

問題2: You have unlinked kegs in your Cellar

解決法 #2
何か一部のツールが unlink になっているらしいので、brew link コマンドを使用する。

$ brew link mpfr
Linking /usr/local/Cellar/mpfr/3.1.2-p8... 0 symlinks created

$ brew link node_modules
Error: Multiple kegs installed to /usr/local/Cellar/node_modules
However we don't know which one you refer to.
Please delete (with rm -rf!) all but one and then try again.

$ brew link python
Linking /usr/local/Cellar/python/2.7.8... 0 symlinks created

$ brew link python3
Linking /usr/local/Cellar/python/2.7.8... 0 symlinks created

$ brew link python3
Linking /usr/local/Cellar/python3/3.4.1... 0 symlinks created

node_modulesだけ何かおかしい...
エラー内容を読むとnpmでインストールされているパッケージのどれを参照しているのか分からないらしい。

$ ls /usr/local/Cellar/node_modules
http     mtwitter ntwitter oauth    twitter

とりあえず応急処置的にtwitterだけ残して残りは全部アンインストールしてみる。

$ npm uninstall mtwitter
unbuild mtwitter@1.6.4
$ npm uninstall ntwitter
unbuild ntwitter@0.5.0
$ npm uninstall http
unbuild http@0.0.0
$ npm uninstall oauth
unbuild oauth@0.9.12

ここでbrew linkを使う

$ brew link node_modules
Linking /usr/local/Cellar/node_modules/twitter... 3 symlinks created

問題3: Warning: /usr/bin occurs before /usr/local/bin

解決法 #3
Consider amending your PATH so that /usr/local/bin
occurs before /usr/bin Here is a one-liner:
  echo export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile

このメッセージの通り、".bash_profile"のPATHを設定する。

コマンドラインにてvimで.bash_profileを開く。

$ vim ~/.bash_profile
export PATH=/usr/local/bin:$PATH  # 1行目に追加。

最後にbrew doctorを叩く

$ brew doctor
Your system is ready to brew.

全て正常に戻りました!٩('ω' )و
結構時間かかりました。。。

参考にしたサイトとか

Homebrewのエラーを治す
http://qiita.com/cubdesign/items/176e655a14d47b374a75

homebrew brew doctorトラブルシューティング
http://bismar.hatenablog.com/entry/2012/12/06/022457

brew doctorのwarningを解決する
http://mrk1869.com/blog/brew_doctor/

Mountain Lion環境へのHomebrew & gitインストール手順
http://blog.pinkpinkpink.net/2012/07/homebrew.html

ヾ(o゚ω゚o)ノ゙brew updateでエラーでたった[Homebrew]
http://qiita.com/harapeko_wktk/items/f4f44ddb5d3912e15ea2

74
68
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
74
68

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?