你的osx中没有gitk?

当在osx系统中发现没有gitk时,原因可能是git版本过低。解决方法是通过brew更新和升级git。首先检查git版本,然后执行`brew update`和`brew install git`。如果git路径未正确设置,执行`echo 'export PATH="/usr/local/opt/git/bin:$PATH"' >> ~/.bash_profile`。最后,使用`brew upgrade git`确保git版本是最新的,这样就能正常使用gitk了。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

你的osx中没有gitk?一句话:你的git版本太低了,gitk是跟随git一起安装的。

解决办法:重新使用brew安装git就好了。

先看下git版本:

andy@AndyMacBookPro:~$ git --version
git version 1.9.5 (Apple Git-50.3)

可以使用brew重新安装git:

首先升级brew:

brew update

然后安装git:

andy@AndyMacBookPro:/usr/local/webdata/chrome_ext/fanlihelper$ brew install git
==> Downloading https://homebrew.bintray.com/bottles/git-2.6.2.mavericks.bottle.tar.gz
######################################################################## 100.0%
==> Pouring git-2.6.2.mavericks.bottle.tar.gz
==> Caveats
The OS X keychain credential helper has been installed to:
  /usr/local/bin/git-credential-osxkeychain

The "contrib" directory has been installed to:
  /usr/local/share/git-core/contrib

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completion has been installed to:
  /usr/local/share/zsh/site-functions
==> Summary
/usr/local/Cellar/git/2.6.2: 1398 files, 33M

安装之后发现git版本还是没有变:

andy@AndyMacBookPro:/usr/local/webdata/chrome_ext/fanlihelper$ git --version
git version 1.9.5 (Apple Git-50.3)

我们使用which git,发现git的目录还是/usr/bin/git,按理git应该位于/usr/local/bin/git中才对,是目录在profile中没有设置好,所以我们先升级brew:

brew upate

最后发现有此提示:

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

然后我们根据提示来执行:

echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile

参考()这里,这么说的:

If you already have git installed via homebrew, you can just do upgrade:

也就是说,刚刚我们已经brew install git过了,我们现在导入了path之后,我们可以直接:

brew upgrade git就可以了,效果如下:

$ which git
/usr/bin/git
$ brew upgrade git
$ which git
/usr/local/bin/git

之后我们看到git版本正确了:

andy@AndyMacBookPro:/usr/local/Cellar/git/2.6.2$ git version
git version 2.6.2

然后我们这时候在shell中执行gitk也可以了~~

最后我们看一下系统中的情况:

andy@AndyMacBookPro:/usr/local/Cellar/git/2.6.2$ /usr/bin/git version
git version 1.9.5 (Apple Git-50.3)
andy@AndyMacBookPro:/usr/local/Cellar/git/2.6.2$ git version
git version 2.6.2
andy@AndyMacBookPro:/usr/local/Cellar/git/2.6.2$ which git
/usr/local/bin/git
andy@AndyMacBookPro:/usr/local/Cellar/git/2.6.2$ which gitk
/usr/local/bin/gitk
andy@AndyMacBookPro:/usr/local/Cellar/git/2.6.2$

可以看到目前我们osx中有两个git,而gitk也在/usr/local/bin/ 目录下。

参考:
http://stackoverflow.com/questions/17582685/install-gitk-on-mac

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值