我在 OS X El Capitan 上安装了 Homebrew。在安装的最后一步中,我应该使用以下命令安装 git:
brew install git
这还好。现在,如果我运行“brew doctor”,就会出现以下情况:
$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!
Warning: Git could not be found in your PATH.
Homebrew uses Git for several internal functions, and some formulae use Git
checkouts instead of stable tarballs. You may want to install Git:
brew install git
如果我再次运行'brew install git',将会得到以下结果:
$ brew install git
Warning: git-2.7.4 already installed
毋庸置疑,我的Git版本是2.7.4。执行'brew update'命令出现以下错误:
$ brew update
Warning: git-2.7.4 already installed
Error: Git must be installed and in your PATH!
问题:如何修复我的 PATH,以便于能够在 PATH 中找到 git,并使 'brew doctor' 的结果为 'Your system is ready to brew'?
附加信息:
which -a git results in:
$ which -a git /usr/local/bin/git /usr/local/bin/git /usr/bin/git
I tried a lot of potential fixes, meanwhile I executed:
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile
My ~/.bash_profile now looks like this:
# Setting PATH for Python 2.7 # The orginal version is saved in .bash_profile.pysave PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}" export PATH=/usr/local/bin:$PATH
When I try to install cask:
$ brew tap caskroom/cask ==> Installing git Warning: git-2.7.4 already installed Error: Git is unavailable
brew config:
$ brew config HOMEBREW_VERSION: 0.9.5 ORIGIN: (none) HEAD: (none) Last commit: never HOMEBREW_PREFIX: /usr/local HOMEBREW_REPOSITORY: /usr/local HOMEBREW_CELLAR: /usr/local/Cellar HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com CPU: quad-core 64-bit haswell OS X: 10.11.4-x86_64 Xcode: 7.3 CLT: 7.3.0.0.1.1457485338 Clang: 7.3 build 703 X11: N/A System Ruby: 2.0.0-p648 Perl: /usr/bin/perl Python: /usr/local/bin/python => /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/bin/python2.7 Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby Java: 1.8.0_40
编辑:添加了cask到附加信息。
编辑2:添加了brew config并添加了brew doctor前缀。
brew doctor
和brew config
的完整输出。 - bfontainebrew config
并完成了brew doctor
(关于 Homebrew 警告的一般注释,我一开始认为它们不重要)。 - ncwsource ~/.bash_profile
命令可以解决这个问题吗? - bfontainebrew doctor
仍然提供相同的输出。 - ncwbrew info git
的输出是什么? - bfontaine