Xcode 4 是否安装了 git?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5364340/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Does Xcode 4 install git?
提问by Matthew Rankin
I bought a new MacBook Pro and installed the applications list below in order. On my old MacBook, also running OS X 10.6.6, I didn't have /usr/bin/git
, however, on the new MacBook Pro, I do. The only differences that I can think of between the two systems are:
我买了一台新的 MacBook Pro 并按顺序安装了下面的应用程序列表。在同样运行 OS X 10.6.6 的旧 MacBook 上,我没有/usr/bin/git
,但是,在新的 MacBook Pro 上,我有。我能想到的两个系统之间的唯一区别是:
- New MacBook Pro has Xcode 4 vs. Xcode 3 on old MacBook
- New MacBook Pro installed git using homebrewvs. old MacBook installed [git-osx-installer][]
- 新 MacBook Pro 在旧 MacBook 上具有 Xcode 4 与 Xcode 3
- 使用自制软件安装 git 的新 MacBook Pro与安装的旧 MacBook [git-osx-installer][]
Homebrewinstalled git 1.7.4.1 into /usr/local/Cellar/git
and symlinked it into /usr/local/bin
. This leads me to believe that Xcode 4 installed git
1.7.3.4 into /usr/bin
. Can anyone confirm or deny this?
Homebrew将 git 1.7.4.1 安装/usr/local/Cellar/git
到/usr/local/bin
. 这让我相信 Xcode 4 将git
1.7.3.4安装到/usr/bin
. 任何人都可以确认或否认这一点吗?
If Xcode 4 didn't install git 1.7.3.4 into /usr/bin
, any thoughts what program did?
如果 Xcode 4 没有将 git 1.7.3.4 安装到/usr/bin
,有什么想法是什么程序吗?
Applications Installed in Order
按顺序安装的应用程序
- First boot
- Ran Apple's Software Update
- Ran Bootcamp to create 48GB NTFS partition for Windows 7
- Installed iWork '09 and ran software update to install iWork Update 5
- Installed TextExpander 3.2.4
- Installed Dropbox 1.0.20
- Installed 1Password 3.5.9
- Installed Alfred 0.8.2 (107)
- Installed Adium 1.4.1
- Started installation of Xcode4 via App Store
- Installed Caffeine 1.1.1 via App Store
- Installed Kindle via App Store
- Completed installation of Xcode 4 via App Store
- Installed Homebrew using the following command:
ruby -e "$(curl -fsSLk https://gist.github.com/raw/323731/install_homebrew.rb)"
- Installed git using
brew install git
- Installed MacVim using
brew install macvim
- 首次开机
- 跑苹果的软件更新
- 运行 Bootcamp 为 Windows 7 创建 48GB NTFS 分区
- 安装 iWork '09 并运行软件更新以安装 iWork Update 5
- 已安装 TextExpander 3.2.4
- 安装 Dropbox 1.0.20
- 安装 1Password 3.5.9
- 已安装 Alfred 0.8.2 (107)
- 安装 Adium 1.4.1
- 通过 App Store 开始安装 Xcode4
- 通过 App Store 安装 Caffeine 1.1.1
- 通过 App Store 安装 Kindle
- 通过 App Store 完成 Xcode 4 的安装
- 使用以下命令安装 Homebrew:
ruby -e "$(curl -fsSLk https://gist.github.com/raw/323731/install_homebrew.rb)"
- 安装 git 使用
brew install git
- 安装 MacVim 使用
brew install macvim
Update: Package Receipt Info
更新:包裹收据信息
I ran pkgutil --file-info /usr/bin/git
and the following info was displayed. This appears to incriminate Xcode 4.
我跑了pkgutil --file-info /usr/bin/git
,显示了以下信息。这似乎使 Xcode 4 有罪。
volume: /
path: /usr/bin/git
pkgid: com.apple.pkg.GitLeo
pkg-version: 4.0.0.9000000000.1.1248867338
install-time: 1300459157
uid: 0
gid: 0
mode: 755
Why It's a Problem that Xcode 4 Installs git
为什么 Xcode 4 安装 git 会出现问题
By default, the path /usr/local/bin
is after /usr/bin
(see the file /etc/paths
). This means that git 1.7.3.4 is used instead of 1.7.4.1 that Homebrew installed.
默认情况下,路径/usr/local/bin
在之后/usr/bin
(请参阅文件/etc/paths
)。这意味着使用 git 1.7.3.4 而不是 Homebrew 安装的 1.7.4.1。
采纳答案by Guy Allard
Yes, it does. I just finished the Xcode 4 install. git was previously installed to /usr/local/git.
是的,它确实。我刚刚完成了 Xcode 4 的安装。git 以前安装到 /usr/local/git。
I am new to OS X, and can only suggest swapping the order of those directories in /etc/paths.
我是 OS X 新手,只能建议交换 /etc/paths 中这些目录的顺序。
Not sure what else would/might work.
不知道还有什么会/可能会起作用。
回答by jdownie
Under Preferences, Downloads there was an option for Command Line Tools. I installed that and it worked well.
在首选项、下载下有一个命令行工具选项。我安装了它并且运行良好。
回答by gk5885
I just looked into this and found git in /Applications/Xcode.app/Contents/Developer/usr/bin
after installing Xcode from the App Store on 10.7.4. Adding that directory to my PATH
seems to have done the trick.
在/Applications/Xcode.app/Contents/Developer/usr/bin
10.7.4 上从 App Store 安装 Xcode 后,我刚刚查看了这个并发现了 git in 。将该目录添加到我的PATH
似乎已经完成了。
回答by Victor
I had to install the command line tools. Here's a helpful answer https://github.com/mxcl/homebrew/issues/10244#issuecomment-4013781
我必须安装命令行工具。这是一个有用的答案https://github.com/mxcl/homebrew/issues/10244#issuecomment-4013781
回答by Erik
Xcode 4 installs git at /Developer/usr/bin and at /usr/bin. Xcode 4 uses the version at /Developer/usr/bin. I believe Xcode 4 also invokes git with a full path, so changing the path variable won't change the version of git being used by Xcode 4 itself. Of course, if you are just using git outside of Xcode, none of this matters.
Xcode 4 在 /Developer/usr/bin 和 /usr/bin 安装 git。Xcode 4 使用 /Developer/usr/bin 中的版本。我相信 Xcode 4 也会使用完整路径调用 git,因此更改路径变量不会更改 Xcode 4 本身使用的 git 版本。当然,如果你只是在 Xcode 之外使用 git,这些都不重要。
回答by SystematicFrank
I have been dealing with that same problem. Since I added the new default push style to my git command several programs have been failing because they were still using some internal old version of git.
我一直在处理同样的问题。自从我将新的默认推送样式添加到我的 git 命令后,几个程序一直失败,因为它们仍在使用一些内部旧版本的 git。
I think I gave a good temporal solution here:
我想我在这里给出了一个很好的时间解决方案: