1
hzlez 2014-11-21 15:49:24 +08:00
$ which git
/usr/local/bin/git 你brew install的git在不在/usr/local/bin中呢。 |
3
turandot OP @hzlez
➜ ~ brew list git openssl wget ➜ ~ which openssl /usr/bin/openssl ➜ ~ which wget /usr/local/bin/wget ➜ ~ which git /usr/bin/git 这是啥情况?为毛git和openssl在/usr/bin/但是wget在/usr/local/bin/? |
4
ooxxcc 2014-11-21 16:02:48 +08:00
brew info git呢
你有没有brew link git |
5
ooxxcc 2014-11-21 16:03:07 +08:00
另外看一下/usr/local/sbin/git存在不存在
|
6
turandot OP @ooxxcc
➜ ~ brew info git git: stable 2.1.3 (bottled), HEAD http://git-scm.com /usr/local/Cellar/git/2.1.3 (1342 files, 32M) * Poured from bottle From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/git.rb ==> Dependencies Optional: pcre ✘, gettext ✘ ==> Options --with-blk-sha1 Compile with the block-optimized SHA1 implementation --with-brewed-curl Use Homebrew's version of cURL library --with-brewed-openssl Build with Homebrew OpenSSL instead of the system version --with-brewed-svn Use Homebrew's version of SVN --with-gettext Build with gettext support --with-pcre Build with pcre support --with-persistent-https Build git-remote-persistent-https from "contrib" directory --without-completions Disable bash/zsh completions from "contrib" directory --HEAD install HEAD version ==> 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 ————————————————————————我是分割线———————————————————————————————————— ➜ ~ /usr/local/sbin/git zsh: no such file or directory: /usr/local/sbin/git ————————————————————————我是分割线———————————————————————————————————— 没有brew link git,想的是设置好环境变量后通过brew install的都可以覆盖系统自带的 |
7
goofansu 2014-11-21 16:11:40 +08:00 via iPad
.bash_profile里要加一句话的
|
8
turandot OP @goofansu
是echo export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile吗? 每次brew update后brew doctor都会提示,设置似乎只对当前生效,每次update后都要再来一遍... |
9
turandot OP 奇了怪了,reopen一下iterm,没有动任何设置,居然又发生了变化:
➜ ~ cat /etc/paths /usr/local/bin /usr/local/sbin /usr/bin /bin /usr/sbin /sbin ➜ ~ echo $PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin ➜ ~ git --version git version 1.9.3 (Apple Git-50) echo $PATH的结果和之前不一样了 |
10
turandot OP #update
好像是因为ohmyzsh的配置文件也设置了环境变量... |
11
jsfaint 2014-11-21 16:38:00 +08:00
楼主你用的是zsh,PATH修改应该在.zshrc里面吧
|
12
ooxxcc 2014-11-21 16:39:26 +08:00
@turandot 你不link的话/usr/local/bin根本不会有git,你怎么设置PATH都没用啊
除非你把 /usr/local/Cellar/git/2.1.3 添加到PATH变量 另外你用zsh调什么.bash_profile 槽点太多…… |
13
ooxxcc 2014-11-21 16:39:50 +08:00
楼下可以散了
|
14
canautumn 2014-11-21 16:40:17 +08:00
把环境变量加到.zshrc里,不要加到.bash_profile里
|