Mac下安装thrift

  1. 首先安装homebrew,网上有很多文章可以参考,这里不再赘述。
  2. homebrew安装完毕之后,使用brew install thrift命令安装,但是……此时homebrew安装的thrift可能不是你想要的版本,请看第三点。
  3. 如果brew中thrift不是想要的版本,可以使用如下命令,搜索brew中包含的thrift版本:
~ brew search thrift
==> Formulae
thrift                                                             [email protected]

   如上所示,brew中包含的thrift版本,但是此时还是不清楚具体版本。请使用如下命令进入brew在本地中的存储位置:

~ cd $(brew --repo)
~ cd Library/Taps/homebrew/homebrew-core/Formula/

 其实就是github文件在本地的clone,此时直接查看thrift.rb 或者 [email protected]即可看到具体版本。

 其中homebrew中thrift最新版本在thrift.rb文件中,该文件最新地址:

  https://github.com/Homebrew/homebrew-core/blob/master/Formula/thrift.rb

 如果这两个文件中都不是你想要的版本,可以去homebrew对应github仓库中查找,其中 0.9.3对应地址如下:

 https://github.com/Homebrew/homebrew-core/blob/9d524e4850651cfedd64bc0740f1379b533f607d/Formula/thrift.rb

 或者直接使用如下命令查看本地brew包含的thrift版本:

~ brew edit [email protected]
class ThriftAT09 < Formula
  desc "Framework for scalable cross-language services development"
  homepage "https://thrift.apache.org"
  url "https://archive.apache.org/dist/thrift/0.9.3/thrift-0.9.3.tar.gz"
  sha256 "b0740a070ac09adde04d43e852ce4c320564a292f26521c46b78e0641564969e"

  bottle do
    cellar :any
    sha256 "9bf6dbb1699dd2e47ec08c0a6c45d922bfe44e39541cfa824c6d3fa0e612cbee" => :high_sierra
    sha256 "52d2ce63e41f13d81c4df4cff528d5bd25b75b09316a59e0cd7060bbb313a831" => :sierra

 如上图所示,可以看到具体版本。 

 若要替换thrift.rb,使用如下命令:

~ rm thrift.rb
# download 0.9.3 thrift.rb
~ wget https://raw.githubusercontent.com/Homebrew/homebrew-core/9d524e4850651cfedd64bc0740f1379b533f607d/Formula/thrift.rb
~ brew install thrift

安装完毕,若要恢复,使用如下命令:

~ git reset HEAD --hard

使用brew安装完之后,出现如下提示:

[email protected] is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have [email protected] first in your PATH run:
  echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc

For compilers to find [email protected] you may need to set:
  export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
  export CPPFLAGS="-I/usr/local/opt/[email protected]/include"

For pkg-config to find [email protected] you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"

 此时需要按照上述提示信息,把thrift路径放在系统执行PATH后,然后重启Teminal即可使用。

  

  

你可能感兴趣的:(rpc)