少於 1 分鐘閱讀

錯誤訊息

xxx> gem install rest-client

Building native extensions.  This could take a while...
ERROR:  Error installing rest-client:
	ERROR: Failed to build gem native extension.

    current directory: /Users/xxx/.rvm/gems/ruby-2.3.1/gems/unf_ext-0.0.7.2/ext/unf_ext
/Users/XinYing/.rvm/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20161114-2590-1md66fr.rb extconf.rb
checking for main() in -lstdc++... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

解決過程

爬文 有人說是因為缺gcc Linux: yum install gcc-c++ 有人說需要安裝這個 macOS:brew install coreutils

我嘗試執行brew install coreutils,結果出現:

Error: You have not agreed to the Xcode license. Please resolve this by running:
  sudo xcodebuild -license accept

讓我想起最近好像有更新Xcode,想是license有更新又要重新同意了,我馬上執行了

sudo xcodebuild -license accept

就不裝coreutils,直接測試 gem install rest-client 結果就成功了

解決方式

只要把xcode license同意即可

sudo xcodebuild -license accept

更新時間:

留言