Mac OSX下安装Thrift

具体安装步骤:

在mac下安装软件跟Linux安装比较类似,在安装Thrift之前需要先安装依赖。

1、安装BOOST

1
2
3
4
5
下载:http://www.boost.org/ boost_1_57_0.tar.gz)
解压:tar -zvxf boost_1_57_0.tar.gz

切换目录:cd boost_1_57_0
命令:./bootstrap.sh,该命令用于生成bjam可执行文件,这个东西就是用来编译boost库
命令:sudo ./b2 threading=multi address-model=64 variant=release stage install

2、安装 libevent

1
2
3
4
5
6
下载:http://libevent.org/  (libevent-2.0.21-stable.tar.gz)
解压:tar -zvxf libevent-2.0.21-stable.tar.gz
切换目录:cd libevent-2.0.21-stable
命令:./configure --prefix=/usr/local
命令:make
命令:sudo make install

3、安装 Apache Thrift

1
2
3
4
5
下载:http://thrift.apache.org/  (thrift-0.8.0.tar.gz)
解压:tar -zvxf thrift-0.8.0.tar.gz
切换目录:cd thrift-0.8.0.tar.gz
编译命令:./configure --prefix=/usr/local/ --with-boost=/usr/local --with-libevent=/usr/local
安装命令:sudo make install

thrift -version 可以查看安装是否成功和版本
注意版本选择:选择Thrift 0.8.0版本,选择高的版本会报bison版本低的错误,在安装0.8.0时也报了一些错误,不过不影响正常使用。