解决 Mac OS 10.14: 升级Cocopods Failed to build gem native extension

在升级cocoapods 时使用

sudo gem install cocoapods

会报如下错误:

Building native extensions. This could take a while...

ERROR:  Error installing cocoapods:

ERROR: Failed to build gem native extension.

如果是之前的 Mac OS 版本,网上都是通过xcode-select --install 来解决,但是我在 Mac OS 10.14.1 版本下,依然存在报错。

最后找到如下方法:

open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

之后按提示安装完成,在执行sudo gem install cocoapods命令,成功升级,如下:

Done installing documentation for ffi, ethon, typhoeus, cocoapods-core, cocoapods-deintegrate, cocoapods-downloader, cocoapods-trunk, molinillo, atomos, nanaimo, xcodeproj, fourflusher, ruby-macho, cocoapods after 44 seconds

14 gems installed

你可能感兴趣的:(解决 Mac OS 10.14: 升级Cocopods Failed to build gem native extension)