Help us understand the problem. What is going on with this article?

Homebrewのエラーを治す

More than 5 years have passed since last update.
コンソール
$ brew doctor

いっぱいエラーがでた。

コンソール
Warning: /usr/local/lib/pkgconfig isn't writable.
This can happen if you "sudo make install" software that isn't managed by
by Homebrew. If a brew tries to write a file to this directory, the
install will fail during the link step.

You should probably `chown` /usr/local/lib/pkgconfig
xcrun: error: active developer path ("/Volumes/Xcode 4.5 DP4/Xcode45-DP4.app/Contents/Developer") does not exist, use xcode-select to change
xcrun: error: active developer path ("/Volumes/Xcode 4.5 DP4/Xcode45-DP4.app/Contents/Developer") does not exist, use xcode-select to change

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
    /usr/local/lib/libavcodec.54.91.100.dylib
    /usr/local/lib/libavdevice.54.3.102.dylib
    /usr/local/lib/libavfilter.3.34.101.dylib
    /usr/local/lib/libavformat.54.61.104.dylib
    /usr/local/lib/libavutil.52.17.100.dylib
    /usr/local/lib/libmp3lame.0.dylib
    /usr/local/lib/libswresample.0.17.102.dylib
    /usr/local/lib/libswscale.2.2.100.dylib

Warning: Unbrewed .la files were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .la files:
    /usr/local/lib/libmp3lame.la

Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .pc files:
    /usr/local/lib/pkgconfig/fuse.pc
    /usr/local/lib/pkgconfig/libavcodec.pc
    /usr/local/lib/pkgconfig/libavdevice.pc
    /usr/local/lib/pkgconfig/libavfilter.pc
    /usr/local/lib/pkgconfig/libavformat.pc
    /usr/local/lib/pkgconfig/libavutil.pc
    /usr/local/lib/pkgconfig/libswresample.pc
    /usr/local/lib/pkgconfig/libswscale.pc
    /usr/local/lib/pkgconfig/nodejs.pc

Warning: Unbrewed static libraries were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected static libraries:
    /usr/local/lib/libavcodec.a
    /usr/local/lib/libavdevice.a
    /usr/local/lib/libavfilter.a
    /usr/local/lib/libavformat.a
    /usr/local/lib/libavutil.a
    /usr/local/lib/libmp3lame.a
    /usr/local/lib/libswresample.a
    /usr/local/lib/libswscale.a

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:

    node
    pcre
xcrun: error: active developer path ("/Volumes/Xcode 4.5 DP4/Xcode45-DP4.app/Contents/Developer") does not exist, use xcode-select to change
xcrun: error: active developer path ("/Volumes/Xcode 4.5 DP4/Xcode45-DP4.app/Contents/Developer") does not exist, use xcode-select to change

Warning: Missing git origin remote.

Without a correctly configured origin, Homebrew won't update
properly. You can solve this by adding the Homebrew remote:
  cd /usr/local
  git remote add origin https://github.com/Homebrew/homebrew.git
xcrun: error: active developer path ("/Volumes/Xcode 4.5 DP4/Xcode45-DP4.app/Contents/Developer") does not exist, use xcode-select to change

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:

    dbilogstrip
    dbiprof
    dbiproxy

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
xcrun: error: active developer path ("/Volumes/Xcode 4.5 DP4/Xcode45-DP4.app/Contents/Developer") does not exist, use xcode-select to change

Warning: A newer Command Line Tools release is available
Update them from Software Update in the App Store.
xcrun: error: active developer path ("/Volumes/Xcode 4.5 DP4/Xcode45-DP4.app/Contents/Developer") does not exist, use xcode-select to change

権限エラー

修正する

コンソール
$ sudo chown {your-user-name} /usr/local/lib/pkgconfig

余分なファイルを消す

コンソール
$ rm -rf /usr/local/lib/libavcodec.54.91.100.dylib
$ rm -rf /usr/local/lib/libavdevice.54.3.102.dylib
$ rm -rf /usr/local/lib/libavfilter.3.34.101.dylib
$ rm -rf /usr/local/lib/libavformat.54.61.104.dylib
$ rm -rf /usr/local/lib/libavutil.52.17.100.dylib
$ rm -rf /usr/local/lib/libmp3lame.0.dylib
$ rm -rf /usr/local/lib/libswresample.0.17.102.dylib
$ rm -rf /usr/local/lib/libswscale.2.2.100.dylib


$ rm -rf /usr/local/lib/libmp3lame.la


$ rm -rf /usr/local/lib/pkgconfig/fuse.pc
$ rm -rf /usr/local/lib/pkgconfig/libavcodec.pc
$ rm -rf /usr/local/lib/pkgconfig/libavdevice.pc
$ rm -rf /usr/local/lib/pkgconfig/libavfilter.pc
$ rm -rf /usr/local/lib/pkgconfig/libavformat.pc
$ rm -rf /usr/local/lib/pkgconfig/libavutil.pc
$ rm -rf /usr/local/lib/pkgconfig/libswresample.pc
$ rm -rf /usr/local/lib/pkgconfig/libswscale.pc
$ rm -rf /usr/local/lib/pkgconfig/nodejs.pc


$ rm -rf /usr/local/lib/libavcodec.a
$ rm -rf /usr/local/lib/libavdevice.a
$ rm -rf /usr/local/lib/libavfilter.a
$ rm -rf /usr/local/lib/libavformat.a
$ rm -rf /usr/local/lib/libavutil.a
$ rm -rf /usr/local/lib/libmp3lame.a
$ rm -rf /usr/local/lib/libswresample.a
$ rm -rf /usr/local/lib/libswscale.a

リンクの設定

コンソール
$ brew link node
$ brew link pcre

nodeがリンクできないなどのエラーがでたので削除して、再インストールした

コンソール
$ sudo brew uninstall node.js
$ brew install node

こんなエラーがでたので

コンソール
$ Target /usr/local/lib/dtrace/node.d already exists. You may need to delete it.

これ

コンソール
$ brew link --overwrite node

さらに

コンソール
$ Error: Permission denied - /usr/local/lib/dtrace/node.d

これ

Error: The 'brew link' step did not complete successfully

node を消して、再インストール

コンソール
$ brew uninstall npm
$ brew uninstall node
$ npm uninstall npm -g
$ sudo rm -rf /usr/local/lib/node_module

$ sudo rm -rf /usr/local/include/node
$ sudo rm -rf /usr/local/lib/node

$ brew install node

コンソール
$ xcrun: error: active developer path ("/Volumes/Xcode 4.5 DP4/Xcode45-DP4.app/Contents/Developer") does not exist, use xcode-select to change

これ

コンソール
$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

コンソール
$ Warning: /usr/bin occurs before /usr/local/bin

これ

コンソール
echo export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile

これのあとコンソール再起動 ← これにはまった

参考サイト

Mountain Lion環境へのHomebrew & gitインストール手順

Mac OSX に Homebrew をインストールする

infas
出版とデジタルの事業領域で、独創性あふれるプロフェッショナル集団としてチャレンジ精神をもって常に市場ニーズを先取りし、新しい価値と文化を創造しつつ、時代の変化に挑戦し続けることを使命とします。ファッション週刊誌「WWD JAPAN」「WWD BEAUTY」、カルチャー誌「STUDIO VIOCE」を発行。
http://www.infaspub.co.jp/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away