Homebrewのパスエラー

* 本ページはプロモーションが含まれています

またまた、久々にHomebrewをアップデートしようとしたら、下記のエラー

$ brew update
error: Your local changes to the following files would be overwritten by merge:
Library/Contributions/cmds/brew-pull.rb
Library/Contributions/manpages/brew.1.md
Please, commit your changes or stash them before you can merge.
Aborting
Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master

 

エラーの内容は個々で違うようですが、こんな時には、brew doctor

$ brew doctor
Warning: You have leftover files from an older version of Xcode.
You should delete them using:
/Developer/Library/uninstall-developer-folder
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.

….

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

どうやら、/usr/local/binがパスに入ってないか、/usr/binの前に/usr/local/binが明記されてないか。

$ /etc/paths

/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin

/usr/local/binが一番下になっていたので、一番上位に移動。

再ログイン後、

$ cd /usr/local/library
$ git stash && git clean -f
$ brew install p11-kit 

これで、無事アップデートが出来た。


See also