Mac homebrewとgitを入れる

  • homebrewを入れる
$ ruby -e "$(curl -fsSLk https://gist.github.com/raw/323731/install_homebrew.rb)"
  • gitを入れようとする
$ brew install git
  • 以下のエラーがでる場合は、XCodeを開いて Preferences-Download-Command Line Toolsをダウンロードしてから、できるようになります。
  • エラー内容
==> Downloading http://git-core.googlecode.com/files/git-1.7.9.2.tar.gz
File already downloaded in /Users/aaa/Library/Caches/Homebrew
==> make prefix=/usr/local/Cellar/git/1.7.9.2 CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clan
GIT_VERSION = 1.7.9.2
    * new build flags or prefix
    * new link flags
./generate-cmdlist.sh > common-cmds.h+ && mv common-cmds.h+ common-cmds.h
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -o hex.o -c -MF ./.depend/hex.o.d -MMD -MP  -Os -w -pipe -march=native -Qunused-arguments -I. -DUSE_ST_TIMESPEC -DNO_GETTEXT  -DHAVE_DEV_TTY -DSHA1_HEADER='<openssl/sha.h>'  -DNO_MEMMEM  hex.c
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -o ident.o -c -MF ./.depend/ident.o.d -MMD -MP  -Os -w -pipe -march=native -Qunused-arguments -I. -DUSE_ST_TIMESPEC -DNO_GETTEXT  -DHAVE_DEV_TTY -DSHA1_HEADER='<openssl/sha.h>'  -DNO_MEMMEM  ident.c
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -o kwset.o -c -MF ./.depend/kwset.o.d -MMD -MP  -Os -w -pipe -march=native -Qunused-arguments -I. -DUSE_ST_TIMESPEC -DNO_GETTEXT  -DHAVE_DEV_TTY -DSHA1_HEADER='<openssl/sha.h>'  -DNO_MEMMEM  kwset.c
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -o levenshtein.o -c -MF ./.depend/levenshtein.o.d -MMD -MP  -Os -w -pipe -march=native -Qunused-arguments -I. -DUSE_ST_TIMESPEC -DNO_GETTEXT  -DHAVE_DEV_TTY -DSHA1_HEADER='<openssl/sha.h>'  -DNO_MEMMEM  levenshtein.c
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -o list-objects.o -c -MF ./.depend/list-objects.o.d -MMD -MP  -Os -w -pipe -march=native -Qunused-arguments -I. -DUSE_ST_TIMESPEC -DNO_GETTEXT  -DHAVE_DEV_TTY -DSHA1_HEADER='<openssl/sha.h>'  -DNO_MEMMEM  list-objects.c
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -o ll-merge.o -c -MF ./.depend/ll-merge.o.d -MMD -MP  -Os -w -pipe -march=native -Qunused-arguments -I. -DUSE_ST_TIMESPEC -DNO_GETTEXT  -DHAVE_DEV_TTY -DSHA1_HEADER='<openssl/sha.h>'  -DNO_MEMMEM  ll-merge.c
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -o lockfile.o -c -MF ./.depend/lockfile.o.d -MMD -MP  -Os -w -pipe -march=native -Qunused-arguments -I. -DUSE_ST_TIMESPEC -DNO_GETTEXT  -DHAVE_DEV_TTY -DSHA1_HEADER='<openssl/sha.h>'  -DNO_MEMMEM  lockfile.c
In file included from hex.c:1:
In file included from ./cache.h:In file included from ident.c:8:
In file included from 4:
./git-compat-util.h:93:10:./cache.h:4:
./git-compat-util.h:93:10: fatal error: 'unistd.h' file not found
 fatal error: 'unistd.h' file not found
#include <unistd.h>
         ^
#include <unistd.h>
         ^
In file included from kwset.c:37:
In file included from ./cache.h:4:
./git-compat-util.h:93:10: fatal error: 'unistd.h' file not found
#include <unistd.h>
         ^
In file included from levenshtein.c:1:
In file included from ./cache.h:4:
./git-compat-util.h:93:10: fatal error: 'unistd.h' file not found
#include <unistd.h>
         ^
In file included from ll-merge.c:7:
In file included from ./cache.h:4:
./git-compat-util.h:93:10: fatal error: 'unistd.h' file not found
#include <unistd.h>
         ^
In file included from list-objects.c:1:
In file included from ./cache.h:4:
./git-compat-util.h:93:10: fatal error: 'unistd.h' file not found
#include <unistd.h>
         ^
In file included from lockfile.c:4:
In file included from ./cache.h:4:
./git-compat-util.h:93:10: fatal error: 'unistd.h' file not found
#include <unistd.h>
         ^
1 error generated.
1 error generated.
1 error generated.
make: *** [levenshtein.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [hex.o] Error 1
1 error generated.
make: *** [ident.o] Error 1
make: *** [lockfile.o] Error 1
1 error generated.
make: *** [ll-merge.o] Error 1
1 error generated.
make: *** [kwset.o] Error 1
1 error generated.
make: *** [list-objects.o] Error 1
==> Exit Status: 2
http://github.com/mxcl/homebrew/blob/master/Library/Formula/git.rb#L47
==> Environment
HOMEBREW_VERSION: 0.8.1
HEAD: (none)
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
Hardware: 8-core 64-bit sandybridge
OS X: 10.7.3
Kernel Architecture: x86_64
Xcode: 3.2.2
GCC-4.0: N/A
GCC-4.2: N/A
LLVM: build 2336
Clang: N/A
MacPorts or Fink? false
X11: /usr/X11
System Ruby: 1.8.7-249
/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
==> Build Flags
CC: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
CXX: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ => /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
LD: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
CFLAGS: -Os -w -pipe -march=native -Qunused-arguments
CXXFLAGS: -Os -w -pipe -march=native -Qunused-arguments
MAKEFLAGS: -j8

Error: Failed executing: make prefix=/usr/local/Cellar/git/1.7.9.2 CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS=-Os\ -w\ -pipe\ -march=native\ -Qunused-arguments LDFLAGS= install
These existing issues may help you:
    https://github.com/mxcl/homebrew/issues/9023
    https://github.com/mxcl/homebrew/issues/9618
    https://github.com/mxcl/homebrew/issues/10225
    https://github.com/mxcl/homebrew/issues/10544
Otherwise, please report the bug:
    https://github.com/mxcl/homebrew/wiki/checklist-before-filing-a-new-issue