如何在mac OSX上安装bison

S7_*_*7_0 25 macos thrift bison

我正在尝试在我的macbook上安装Thrift.否则我收到一个错误:

configure:error:必须在系统上安装Bison 2.5或更高版本!

所以试图在我的操作系统上安装Bison,但我没有在互联网上找到教程.有谁能告诉我如何在我的系统上安装Bison?

亲切的问候

小智 56

看到这里.你可以用brew安装:

brew install bison
Run Code Online (Sandbox Code Playgroud)

然后使用:

brew link bison --force
Run Code Online (Sandbox Code Playgroud)

如有必要,请不要忘记取消链接(brew unlink bison).


Har*_*ley 14

我需要export PATH="/usr/local/opt/bison/bin:$PATH" brew install bison在 /usr/local/Cellar设置安装野牛新版本,但此路径未在 $PATH 中设置


tro*_*foe 10

为了节省大量时间,请使用MacportsHomebrew.这些将为您安装所有依赖包.

我使用Macports,安装后,它就像下面这样简单:

$ sudo port install thrift
Run Code Online (Sandbox Code Playgroud)

它将在你的咖啡准备好之前完成.


cin*_*nqS 5

brew install bison在尝试后和尝试时收到警告brew link bison --force

bison is keg-only, which means it was not symlinked into /usr/local,
because some formulae require a newer version of bison.

If you need to have bison first in your PATH run:
  echo 'export PATH="/usr/local/opt/bison/bin:$PATH"' >> ~/.bash_profile

For compilers to find bison you may need to set:
  export LDFLAGS="-L/usr/local/opt/bison/lib"
Run Code Online (Sandbox Code Playgroud)

所以我建议你在上面添加这两个标志,而不是强制链接/usr/local.

因此,最重要的是,您需要以下三个步骤:

brew install bison
echo 'export PATH="/usr/local/opt/bison/bin:$PATH"' >> ~/.bash_profile
export LDFLAGS="-L/usr/local/opt/bison/lib"
Run Code Online (Sandbox Code Playgroud)