2015-10-01 51 views
-1

我需要在OS X下編譯一些LEX/YACC文件(*.l)。並且需要GNU flex作爲掃描儀。使用brew在OS X上安裝GNU flex但出現錯誤「/ usr/local/lib/pkgconfig不可寫入」。

但是,我在安裝GNU flex時被卡住了。

  1. 運行brew install flex,卻得到了一個錯誤:

    • Error: You must `brew link xz' before flex can be installed

    然後我跑brew link xz,還得到了一個錯誤:

    • Error: Could not symlink lib/pkgconfig/liblzma.pc /usr/local/lib/pkgconfig is not writable.
如何在OS X 10.10上正確安裝flex?這個問題是由我的 home brew造成的嗎?

我的 '釀造' 的一些細節:

運行brew doctor

Warning: /usr/local/lib/pkgconfig isn't writable. 

This can happen if you "sudo make install" software that isn't managed by 
by Homebrew. If a formula tries to write a file to this directory, the 
install will fail during the link step. 

You should probably `chown` /usr/local/lib/pkgconfig 

運行ls命令 [email protected]:~$ ls -la /usr/local/lib/pkgconfig total 16 drwxr-xr-x 4 root wheel 136 Mar 31 2013 . drwxr-xr-x 30 yeze admin 1020 Oct 1 21:05 .. -rw-r--r-- 1 root wheel 405 Mar 30 2013 tcl.pc -rw-r--r-- 1 root wheel 404 Mar 30 2013 tk.pc

+1

'brew doctor'和'ls -la/usr/local/lib/pkgconfig'的輸出是什麼? – IKavanagh

+0

@ xhruso00其實,我不太明白規則......似乎你已經回答了一些問題,比如「無法在Yosemite下安裝Xcode 5」。我認爲我的是同一類型的,所以我應該在哪裏提出這樣的問題? – yeze322

+0

將它們添加到問題中。 – IKavanagh

回答

3

這個問題是由brew造成的。

當你有/usr/local/lib/pkgconfig is not writable.,你應該運行:

chown [YourAccountName] /usr/local/lib/pkgconfig

然後按照指令運行brew link xz。您可能會得到如下回復:Linking /usr/local/Cellar/xz/5.2.1... 53 symlinks created

最後再次嘗試brew install flex,它會起作用。

非常感謝@IKavanagh。

+1

或chown $ USER/usr/local/lib/pkgconfig –