adminでインストールしたbrewだが、普段は一般ユーザfooで作業をしたい。ということでbrew update。
mini:~ foo$ brew update fatal: Unable to create '/usr/local/.git/index.lock': Permission denied Error: Failure while executing: git checkout -q master
そりゃ/usr/local/なんかに一般ユーザ向けパーミッションは付いてないわな。管理ユーザでやらざるを得ないか。
ひとまず毎度のbrew doctorして、確認してみる。
mini:~ foo$ brew doctor Error: /usr/local/etc isn't writable. This can happen if you "sudo make install" software that isn't managed 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/etc Error: /usr/local/share isn't writable. This can happen if you "sudo make install" software that isn't managed 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/share Error: Some directories in /usr/local/share/man aren't writable. This can happen if you "sudo make install" software that isn't managed by Homebrew. If a brew tries to add locale information to one of these directories, then the install will fail during the link step. You should probably `chown` them: /usr/local/share/man /usr/local/share/man/man1 /usr/local/share/man/man5 /usr/local/share/man/man7 Error: The /usr/local directory is not writable. Even if this directory was writable when you installed Homebrew, other software may change permissions on this directory. Some versions of the "InstantOn" component of Airfoil are known to do this. You should probably change the ownership and permissions of /usr/local back to your user account. Error: Your Homebrew is outdated You haven't updated for at least 24 hours, this is a long time in brewland! Error: 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/libjmraid.dylib Error: /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: git git-cvsserver git-receive-pack git-shell git-upload-archive git-upload-pack gitk Consider amending your PATH so that /usr/local/bin is ahead of /usr/bin in your PATH.
libjmraid.dylibのことはインストールの時にもヨシとしたので無視する。
結局、管理者でbrew updateしたほうがいいようですな。
(それにしても"You haven't updated for at least 24 hours, this is a long time in brewland!"って表現にビックリですわw)
あとはPATHの順番を/usr/local/binを/usr/binの前に入れておくくらいかな。.bash_profileに
PATH=/usr/local/bin:/usr/bin:$PATHPATH=/usr/local/bin:$PATH
と追加しとけば良いかしら。
(/usr/binを入れておくと、$PATHに含まれている~/.rbenv/shimsよりも先に/usr/bin/rubyが読まれてしまってマズいことになることが判明orz)