赞
踩
背景:
1、近些时间由python技术栈切入到go的技术栈,事情多了很多,没写过文章,刚好最近有空记录下自己mac上安装protobuf环境问题;
操作步骤:
一、源于grpc官网快速开始,安装protobuf环境;
本地环境声明:之前由于xcode觉得占了太多内存所以卸载了,后来没怎么在个人电脑上开发,所以没关注环境破坏情况,当需要使用时候发现又点糟糕;
首先grpc官网指导安装protobuf命令如下:
按照官网指导就碰到了第一次提示,貌似本地git都不在了,还想用brew install protobuf,于是尝试了下git命令还再不提示如下:
- dongchaodeMacBook-Pro:~ dongchao$ git
- xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist
- 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.
- See `man xcode-select` for more details.
-
- 给了提示,于是进去看了一眼;
- dongchaodeMacBook-Pro:~ dongchao$ man xcode-select
上述也提示了怎么解决,于是动手:
- 下载:xcode-select --install
-
- 安装等待完成后终端git还是运行有问题,发现man xcode-select是有一个:xcode-select -r
- 重置记得使用sudo命令;
之后再次检查git命令已经ok,接下来我们继续装protobuf;
再次的异常:
- dongchaodeMacBook-Pro:~ dongchao$ brew install protobuf
- Updating Homebrew...
- Traceback (most recent call last):
- 10: from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `<main>'
- 9: from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `require_relative'
- 8: from /usr/local/Homebrew/Library/Homebrew/global.rb:28:in `<top (required)>'
- 7: from /usr/local/Homebrew/Library/Homebrew/global.rb:28:in `require'
- 6: from /usr/local/Homebrew/Library/Homebrew/os.rb:3:in `<top (required)>'
- 5: from /usr/local/Homebrew/Library/Homebrew/os.rb:21:in `<module:OS>'
- 4: from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:58:in `prerelease?'
- 3: from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:24:in `version'
- 2: from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:24:in `new'
- 1: from /usr/local/Homebrew/Library/Homebrew/os/mac/version.rb:26:in `initialize'
- /usr/local/Homebrew/Library/Homebrew/version.rb:368:in `initialize': Version value must be a string; got a NilClass () (TypeError)
-
然后继续解决:
- dongchaodeMacBook-Pro:~ dongchao$ brew update-reset
-
- 更新后再次:
- brew install protobuf
- 终于成功,接下来是继续按照grpc官网继续往下了;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。