読者です 読者をやめる 読者になる 読者になる

Homebrew の再インストールでエラー発生

先日、下記ページの方法で Homebrew をアンインストールしたわけだけど、それから今までインストールし直すのを忘れていた。

ターミナルに Homebrew 公式ページに書かれているコマンド

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

を入力して実行。すると

error: unable to create symlink Library/ENV/3.2.6 (Permission denied)
error: unable to create symlink Library/ENV/4.2 (Permission denied)
error: unable to create file Library/ENV/4.3/apr-1-config (Permission denied)
error: unable to create symlink Library/ENV/4.3/bsdmake (Permission denied)
error: unable to create symlink Library/ENV/4.3/c++ (Permission denied)
error: unable to create symlink Library/ENV/4.3/c89 (Permission denied)
error: unable to create symlink Library/ENV/4.3/c99 (Permission denied)
error: unable to create file Library/ENV/4.3/cc (Permission denied)
error: unable to create symlink Library/ENV/4.3/clang (Permission denied)
error: unable to create symlink Library/ENV/4.3/clang++ (Permission denied)
error: unable to create symlink Library/ENV/4.3/cpp (Permission denied)
error: unable to create symlink Library/ENV/4.3/g++ (Permission denied)
error: unable to create symlink Library/ENV/4.3/g++-4.2 (Permission denied)
error: unable to create symlink Library/ENV/4.3/gcc (Permission denied)
error: unable to create symlink Library/ENV/4.3/gcc-4.2 (Permission denied)
error: unable to create symlink Library/ENV/4.3/git (Permission denied)
error: unable to create symlink Library/ENV/4.3/gmake (Permission denied)
error: unable to create symlink Library/ENV/4.3/i686-apple-darwin11-llvm-g++-4.2 (Permission denied)
error: unable to create symlink Library/ENV/4.3/i686-apple-darwin11-llvm-gcc-4.2 (Permission denied)
error: unable to create symlink Library/ENV/4.3/ld (Permission denied)
error: unable to create symlink Library/ENV/4.3/llvm-g++ (Permission denied)
error: unable to create symlink Library/ENV/4.3/llvm-g++-4.2 (Permission denied)
error: unable to create symlink Library/ENV/4.3/llvm-gcc (Permission denied)
error: unable to create symlink Library/ENV/4.3/llvm-gcc-4.2 (Permission denied)
error: unable to create file Library/ENV/4.3/make (Permission denied)
error: unable to create file Library/ENV/4.3/mig (Permission denied)
error: unable to create file Library/ENV/4.3/pod2man (Permission denied)
error: unable to create file Library/ENV/4.3/sed (Permission denied)
error: unable to create symlink Library/ENV/4.3/svn (Permission denied)
error: unable to create file Library/ENV/4.3/xcrun (Permission denied)
error: unable to create file Library/ENV/libsuperenv.rb (Permission denied)
error: unable to create symlink Library/ENV/pkgconfig/10.4 (Permission denied)
fatal: cannot create directory at 'Library/ENV/pkgconfig/10.5': Permission denied
Failed during: git reset --hard origin/master

っていう大量のエラーが発生。user/local/Library に書き込む権限が無いみたいだ。

sudo chown -R ${USER} /usr/local

で手っ取り早く所有者を変更してから再挑戦。

$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1

Press ENTER to continue or any other key to abort
==> Downloading and installing Homebrew...
remote: Finding bitmap roots...
remote: Counting objects: 134114, done.
remote: Compressing objects: 100% (44013/44013), done.
remote: Total 134114 (delta 92839), reused 130181 (delta 89071)
Receiving objects: 100% (134114/134114), 24.59 MiB | 2.26 MiB/s, done.
Resolving deltas: 100% (92839/92839), done.
From https://github.com/mxcl/homebrew
 * [new branch]      master     -> origin/master
HEAD is now at 8bac55c add note about test path to create template
==> Installation successful!
You should run `brew doctor' *before* you install anything.
Now type: brew help

今度は成功した。