2012-06-01 93 views
0

我正在看着this video使用Homebrew安裝git。我已經安裝了Homebrew。我遇到的問題是使用Homebrew安裝git。我輸入brew install git並有一定的錯誤信息。使用Homebrew難以安裝git

錯誤消息:

./generate-cmdlist.sh > common-cmds.h+ && mv common-cmds.h+ common-cmds.h 
/usr/bin/xcrun 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 
/usr/bin/xcrun 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 
/usr/bin/xcrun 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 
In file included from ident.c:8: 
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 hex.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 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> 
     ^
1 error generated. 
make: *** [hex.o] Error 1 
1 error generated. 
make: *** Waiting for unfinished jobs.... 
make: *** [ident.o] Error 1 
1 error generated. 
make: *** [kwset.o] Error 1 
==> Build Environment 
CPU: quad-core 64-bit sandybridge 
MacOS: 10.7.4-x86_64 
Xcode: 4.3.2 
CC: /usr/bin/xcrun clang => /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang 

CXX: /usr/bin/xcrun clang++ => /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ 

LD: /usr/bin/xcrun clang => /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: -j4 
Error: Failed executing: make prefix=/usr/local/Cellar/git/1.7.10.3 CC=/usr/bin/xcrun\ clang CFLAGS=-Os\ -w\ -pipe\ -march=native\ -Qunused-arguments LDFLAGS= install (git.rb:49) 
These existing issues may help you: 
    https://github.com/mxcl/homebrew/issues/8643 
    https://github.com/mxcl/homebrew/issues/9023 
    https://github.com/mxcl/homebrew/issues/9618 
    https://github.com/mxcl/homebrew/issues/10544 
    https://github.com/mxcl/homebrew/issues/11481 
    https://github.com/mxcl/homebrew/issues/12325 
    https://github.com/mxcl/homebrew/issues/12344 
    https://github.com/mxcl/homebrew/issues/12400 
    https://github.com/mxcl/homebrew/issues/12478 
Otherwise, please report the bug: 
    https://github.com/mxcl/homebrew/wiki/reporting-bugs 

我怎麼解決這個問題?需要一些幫助

+2

您是否安裝了命令行工具?你可以通過Xcode來做到這一點。 –

+0

這就是我的問題...現在解決了它...謝謝... – lakesh

回答

5

您必須通過Xcode安裝命令行工具才能獲取所需的標題。

+0

沒有辦法指定git的搜索路徑,例如'brew'的環境變量? – ZhangChn

+0

命令行工具在XCode 4.4中的Preferences/Downloads下可用。 – boxed

+0

**你怎麼看到你已經在XCode 5中安裝了這些命令?**我只看到這個https://dl.dropboxusercontent.com/u/62073194/Screen%20Shot%202013-12-14%20at%2022.17 .44.png –