久しぶりに家のMacでHomebrewをupdateしようとしたらエラーが出たので調べた。
エラーは下記のようなもの。
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- mach (LoadError) from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/local/Library/Homebrew/extend/pathname.rb:2:in `<top (required)>' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/local/Library/Homebrew/global.rb:3:in `<top (required)>' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/local/Library/brew.rb:15:in `<main>'
調べてみると、OS XをEl CapitanにしたことによるSIPの影響らしい。
/user/localのパーミッションを変更すると直るとのこと。
調べてみると「root wheel」になってる。
$ ls -al /usr/local/ total 96 drwxr-xr-x 17 root wheel 578 10 1 2015 .
自分自身に修正。
$ sudo chown $(whoami):admin /usr/local $ ls -al /usr/local/ total 96 drwxr-xr-x 17 kubou admin 578 10 1 2015 .
手動でHomebrewを更新。
$ cd /usr/local/Library/Homebrew $ git pull -q origin refs/heads/master:refs/remotes/origin/master
updateできた!
$ brew update ... Already up-to-date.