Mac系统使用Homebrew升级Git版本
2017-08-16 13:30
627 查看
原先版本 1.7.10.2
升级后版本 2.10.0
① 打开终端,输入brew install git:
③ 输入which git,发现git位于/usr/bin/git目录下
原因是:brew install git后的git安装包在 /usr/local/git 目录下,而系统默认/usr/bin 在/usr/local/bin之前。
所以解决方法就是将/usr/local/bin放在/usr/bin之前。
然后CONTRL+X退出,Y保存,回车
PS:以后如果要直接更新git,在终端直接输入brew upgrade git即可(brew upgrade为升级所有的包)
升级后版本 2.10.0
① 打开终端,输入brew install git:
DavidtekiMacBook-Air:~ du$ brew install git② git安装完成后,输入git --version, 发现仍旧是1.7.10.2
DavidtekiMacBook-Air:~ du$ git --version git version 1.7.10.2 (Apple Git-33)
③ 输入which git,发现git位于/usr/bin/git目录下
DavidtekiMacBook-Air:~ du$ which git /usr/bin/git④ 使用brew doctor,重点看第二个warning。
原因是:brew install git后的git安装包在 /usr/local/git 目录下,而系统默认/usr/bin 在/usr/local/bin之前。
所以解决方法就是将/usr/local/bin放在/usr/bin之前。
DavidtekiMacBook-Air:~ du$ 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: You have unlinked kegs in your Cellar Leaving kegs unlinked can lead to build-trouble and cause brews that depend on those kegs to fail to run properly once built. Run `brew link` on these: git Warning: /usr/bin occurs before /usr/local/bin This means that system-provided programs will be used instead of those provided by Homebrew. The following tools exist at both paths: git git-cvsserver git-shell git-upload-pack Consider setting your PATH so that /usr/local/bin occurs before /usr/bin. Here is a one-liner: echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile Warning: Your Xcode (4.5.2) is outdated. Please update to Xcode 8.2.1 (or delete it). Xcode can be updated from the App Store.⑤ 使用 pico .bash_profile命令,打开配置文件,输入export PATH="/usr/local/bin:$PATH",
然后CONTRL+X退出,Y保存,回车
DavidtekiMacBook-Air:~ du$ pico .bash_profile
export PATH="/usr/local/bin:$PATH"⑥ 退出终端,重新打开,并输入git --version,版本号变为2.10.0
DavidtekiMacBook-Air:~ du$ git --version git version 2.10.0
PS:以后如果要直接更新git,在终端直接输入brew upgrade git即可(brew upgrade为升级所有的包)
DavidtekiMacBook-Air:~ du$ brew upgrade git
相关文章推荐
- VMware, Win7, Mac系统之间使用Git版本控制器的解决方案
- mac系统升级到10.12后homebrew不能正常使用的问题
- Mac 系统使用Git进行版本管理
- Mac升级git版本 以及 使用git和github管理自己的项目---基础操作学习
- mac系统及xcode使用的SVN客户端安装升级
- 详解在visual studio中使用git版本系统(图文)
- 使用yum升级Fedora系统中的firefox为最新发布版本
- 详解在Visual Studio中使用git版本系统(图文)
- mac系统及xcode使用的SVN客户端升级
- 详解在visual studio中使用git版本系统
- 使用Git进行版本控制:(2)在OS X系统上开始使用Git代码仓储
- 详解在Visual Studio中使用git版本系统
- mac系统升级到OS X Yosemite后Wireshark无法使用
- 使用Git在Mac和Windows系统之间进行同步数据
- 详解在Visual Studio中使用git版本系统(图文)
- Mac系统下Homebrew的安装和使用Homebrew安装python
- 详解在visual studio中使用git版本系统(图文)
- 在苹果MAC OS X Lion系统上安装、升级、使用Communicator(OC) for MAC 2011
- 详解在visual studio中使用git版本系统(图文)
- 详解在visual studio中使用git版本系统(图文)