当前位置:   article > 正文

mac下安装protobuf环境问题小记_mac 安装protobuf

mac 安装protobuf

背景:

1、近些时间由python技术栈切入到go的技术栈,事情多了很多,没写过文章,刚好最近有空记录下自己mac上安装protobuf环境问题;

操作步骤:

一、源于grpc官网快速开始,安装protobuf环境;

本地环境声明:之前由于xcode觉得占了太多内存所以卸载了,后来没怎么在个人电脑上开发,所以没关注环境破坏情况,当需要使用时候发现又点糟糕;

首先grpc官网指导安装protobuf命令如下:

按照官网指导就碰到了第一次提示,貌似本地git都不在了,还想用brew install protobuf,于是尝试了下git命令还再不提示如下:

  1. dongchaodeMacBook-Pro:~ dongchao$ git
  2. xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist
  3. Use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `xcode-select --install` to install the standalone command line developer tools.
  4. See `man xcode-select` for more details.
  5. 给了提示,于是进去看了一眼;
  6. dongchaodeMacBook-Pro:~ dongchao$ man xcode-select

上述也提示了怎么解决,于是动手:

  1. 下载:xcode-select --install
  2. 安装等待完成后终端git还是运行有问题,发现man xcode-select是有一个:xcode-select -r
  3. 重置记得使用sudo命令;

之后再次检查git命令已经ok,接下来我们继续装protobuf;

再次的异常:

  1. dongchaodeMacBook-Pro:~ dongchao$ brew install protobuf
  2. Updating Homebrew...
  3. Traceback (most recent call last):
  4. 10: from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `<main>'
  5. 9: from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `require_relative'
  6. 8: from /usr/local/Homebrew/Library/Homebrew/global.rb:28:in `<top (required)>'
  7. 7: from /usr/local/Homebrew/Library/Homebrew/global.rb:28:in `require'
  8. 6: from /usr/local/Homebrew/Library/Homebrew/os.rb:3:in `<top (required)>'
  9. 5: from /usr/local/Homebrew/Library/Homebrew/os.rb:21:in `<module:OS>'
  10. 4: from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:58:in `prerelease?'
  11. 3: from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:24:in `version'
  12. 2: from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:24:in `new'
  13. 1: from /usr/local/Homebrew/Library/Homebrew/os/mac/version.rb:26:in `initialize'
  14. /usr/local/Homebrew/Library/Homebrew/version.rb:368:in `initialize': Version value must be a string; got a NilClass () (TypeError)

然后继续解决:

  1. dongchaodeMacBook-Pro:~ dongchao$ brew update-reset
  2. 更新后再次:
  3. brew install protobuf
  4. 终于成功,接下来是继续按照grpc官网继续往下了;
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/码创造者/article/detail/807696
推荐阅读
相关标签
  

闽ICP备14008679号