2012-11-22 43 views
2

已經安裝了自制軟件,並已下載git,但它不會鏈接。獲取此錯誤消息:自制軟件:不會連接山獅上的git

Consider amending your PATH so that /usr/local/bin 
occurs before /usr/bin in your PATH. 
Warning: You have a non-Homebrew 'pkg-config' in your PATH: 
    /opt/sm/pkg/active/bin/pkg-config 

`./configure` may have problems finding brew-installed packages using 
this other pkg-config. 
unknown7cd1c3e98b07:~ pdenlinger$ brew install git 
Error: git-1.8.0 already installed, it's just not linked 
unknown7cd1c3e98b07:~ pdenlinger$ brew link git 
Linking /usr/local/Cellar/git/1.8.0... Warning: Could not link git. Unlinking... 

Error: Could not symlink file: /usr/local/Cellar/git/1.8.0/bin/gitk 
Target /usr/local/bin/gitk already exists. You may need to delete it. 
To force the link and delete this file, do: 
    brew link --overwrite formula_name 

To list all files that would be deleted: 
    brew link --overwrite --dry-run formula_name 
unknown7cd1c3e98b07:~ pdenlinger$ brew link git 

我該如何解決這個問題?

響應從vi命令:

sudo vi /etc/paths  /usr/local/bin /usr/local/sbin /usr/bin /bin /usr/sbin /sbin 
7 files to edit 


E325: ATTENTION 
Found a swap file by the name "/etc/.paths.swp" 
      owned by: root dated: Thu Nov 22 09:10:09 2012 
     file name: /private/etc/paths 
      modified: no 
     user name: root host name: unknown7cd1c3e98b07.att.net 
     process ID: 98069 (still running) 
While opening file "/etc/paths" 
      dated: Tue Aug 21 15:44:10 2012 

(1) Another program may be editing the same file. 
    If this is the case, be careful not to end up with two 
    different instances of the same file when making changes. 
    Quit, or continue with caution. 

(2) An edit session for this file crashed. 
    If this is the case, use ":recover" or "vim -r /etc/paths" 
    to recover the changes (see ":help recovery"). 
    If you did this already, delete the swap file "/etc/.paths.swp" 
    to avoid this message. 

Swap file "/etc/.paths.swp" already exists! 
[O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort: 
+0

[可能與此問題重複](http://stackoverflow.com/questions/10343834/homebrew-wants-me-to-amend-my-path-no-clue-how) – avelis

回答

5

Possible duplicate of this question ...這個問題的解決是

打開你的/ etc /路徑文件,將/ usr/local/bin目錄之上的在/ usr /斌

$ sudo vi /etc/paths 
/usr/local/bin 
/usr/local/sbin 
/usr/bin 
/bin 
/usr/sbin 
/sbin 
+1

進入命令並得到這個迴應。由於它適合這裏的時間太長,所以將它添加到消息的正文中。 – pdenlinger

+0

什麼?它返回null?無法想象的。不過,你也可以這樣做:導出PATH =「/ usr/local/bin:/ usr/local/sbin:〜/ bin:$ PATH」,它可以做同樣的事情 – toxicate20

+0

你最近的評論有效。謝謝。 – pdenlinger

-1

我正在等我編輯的/ etc /路徑文件中使用

一個 「Permission denied」 錯誤0
$ sudo nano /etc/paths