homebrewインストール

参考:Macのパッケージ管理をMacPortsからhomebrewへ - よんちゅBlog
インストールスクリプト
GitHub - Homebrew/legacy-homebrew: The former home of Homebrew/homebrew (deprecated)
The missing package manager for macOS — The missing package manager for macOS
のものを使う。

mini:~ admin$ /usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/Formula/...
/usr/local/Library/Homebrew/...
==> The following directories will be made group writable:
/usr/local/.
/usr/local/lib
==> The following directories will have their group set to admin:
/usr/local/.
/usr/local/lib

Press enter to continue
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/lib
Password:
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/. /usr/local/lib
==> Downloading and Installing Homebrew...
==> Installation successful!
You should run `brew doctor' *before* you install anything.
Now type: brew help

brew doctorをまず実行しろ、と言ってるので従ってみる。

mini:~ admin$ brew doctor

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: 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: Your Xcode is configured with an invalid path.
You should change it to the correct path. Please note that there is no correct
path at this time if you have *only* installed the Command Line Tools for Xcode.
If your Xcode is pre-4.3 or you installed the whole of Xcode 4.3 then one of
these is (probably) what you want:

    sudo xcode-select -switch /Developer
    sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

DO NOT SET / OR EVERYTHING BREAKS!

ひとつめのエラーに関して確認。

mini:~ admin$ cd /usr/local/
mini:local admin$ ls -alF
total 16
drwxrwxr-x   8 root   admin  272  5 30 15:56 ./
drwxr-xr-x@ 14 root   wheel  476  5 30 12:43 ../
-rw-r--r--   1 admin  admin  159  5 30 15:56 .gitignore
drwxr-xr-x   6 admin  admin  204  5 30 15:56 Library/
-rw-r--r--   1 admin  admin  789  5 30 15:56 README.md
drwxr-xr-x   3 admin  admin  102  5 30 15:56 bin/
drwxrwxr-x   3 root   admin  102  7 25  2011 lib/
drwxr-xr-x   3 admin  admin  102  5 30 15:56 share/

「.」がgroup:adminでrwxだから問題ないと思うのだが…。
ふたつめ。
たしかに/usr/local/lib/libjmraid.dylibというのが居る。ググるひとつだけ見つかったJMicronRAIDドライバjmraiddriver関係であるようだ。おそらくFireRACK RAID 2Bay(DataTale RS-M2QJ)買ってみた - 別館 子子子子子子(ねこのここねこ)RAID用ライブラリと思われる。コレを外すとRS-M2QJに繋がらなくなるおそれがあるので、このまま置いておく。
みっつめ。

mini:~ admin$ sudo xcode-select -print-path
/Developer

たしかにパスが間違っている。ので変更。

mini:~ admin$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
mini:~ admin$ sudo xcode-select -print-path
/Applications/Xcode.app/Contents/Developer

おけ。
ひとつめふたつめはよく分からんのでそのまま残しておく。
続いてgitインストール。

mini:~ admin$ brew install git
==> Downloading http://git-core.googlecode.com/files/git-1.7.10.3.tar.gz
######################################################################## 100.0%
==> make prefix=/usr/local/Cellar/git/1.7.10.3 CC=/usr/bin/clang CFLAGS=-Os -w -
==> make CC=/usr/bin/clang CFLAGS=-Os -w -pipe -march=native -Qunused-arguments 
==> make clean
==> Downloading http://git-core.googlecode.com/files/git-manpages-1.7.10.3.tar.g
######################################################################## 100.0%
==> Downloading http://git-core.googlecode.com/files/git-htmldocs-1.7.10.3.tar.g
######################################################################## 100.0%
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

The OS X keychain credential helper has been installed to:
  /usr/local/bin/git-credential-osxkeychain

The 'contrib' directory has been installed to:
  /usr/local/share/git-core/contrib
==> Summary
/usr/local/Cellar/git/1.7.10.3: 1172 files, 23M, built in 50 seconds

最後にhomebrew自身のアップデート。

mini:~ admin$ brew update
Initialized empty Git repository in /usr/local/.git/
remote: Counting objects: 67703, done.
remote: Compressing objects: 100% (34372/34372), done.
remote: Total 67703 (delta 45178), reused 52757 (delta 32534)
Receiving objects: 100% (67703/67703), 9.58 MiB | 1.36 MiB/s, done.
Resolving deltas: 100% (45178/45178), done.
From https://github.com/mxcl/homebrew
 * [new branch]      gh-pages   -> origin/gh-pages
 * [new branch]      master     -> origin/master
HEAD is now at a1418a8 xchat: add patch for newer glib support
Already up-to-date.

インストール直後の状態。

mini:~ admin$ brew --config
HOMEBREW_VERSION: 0.9
HEAD: a1418a85e820aeafc96b4cfd58d879d16f08xxxx
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: quad-core 64-bit sandybridge
OS X: 10.7.4
Kernel Architecture: x86_64
Xcode: 4.3.2
GCC-4.0: N/A
GCC-4.2: N/A
LLVM: build 2336
Clang: 3.1 build 318
MacPorts or Fink? false
X11: /usr/X11
System Ruby: 1.8.7-357
/usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Which Perl:   /usr/bin/perl
Which Python: /usr/bin/python
Which Ruby:   /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby

いま入っているもの。当然gitだけ。

mini:~ admin$ brew list -version
git 1.7.10.3