17

我正在尝试安装gem install travistravis-cli按照参考https://rubygems.org/gems/travis使用,但出现以下错误。

此处提到的尝试解决方案https://github.com/ffi/ffi/issues/653

brew reinstall libffi
export LDFLAGS="-L/usr/local/opt/libffi/lib"
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"
gem install travis

framework/Versions/2.3/usr/include/ruby-2.3.0/ruby.h:33: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr /include/ruby-2.3.0/ruby/ruby.h:24:10: 致命错误: 'ruby/config.h' 文件未找到#include "ruby/config.h" ^~~~~~~~~ ~~~~~~ 产生1个错误。检查的程序是: /* begin */ 1: #include "ruby.h" 2: 3: int main(int argc, char * framework/Versions/2.3/usr/include/ruby-2.3.0/ruby.h:33: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr /include/ruby-2.3.0/ruby/ruby.h:24:10: 致命错误: 'ruby/config.h' 文件未找到#include "ruby/config.h" ^~~~~~~~~ ~~~~~~ 产生1个错误。检查的程序是: /* begin */ 1: #include "ruby.h" 2: 3: int main(int argc, char *argv) 4: { 5: 返回 0; 6: } /结束 */

任何帮助将不胜感激!尝试找出但没有帮助

4

5 回答 5

42

这会成功的

sudo gem install -n /usr/local/bin cocoapods -v 1.8.4

最新的 CocoaPods 1.10.0 将无法工作。

更新!

如果你想安装 CocoaPods 1.10.0 + 你可以使用HomeBrew然后在命令行中输入以下内容

brew install cocoapods
于 2021-01-26T13:52:19.070 回答
7

我有同样的问题。我注意到文件在

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin16

我已经用它的命令行工具安装了 XCode 12.2,它没有那个文件夹,而是通用 darwin20。我通过将该文件夹软链接到 Universal-darwin16 来解决它。

从终端:

ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin20 /Library/Developer/CommandLineTools/ SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin16

于 2020-11-17T07:45:35.933 回答
5

感谢之前将 Universal-darwin 符号链接的回复,我发现我的位置在 Xcode 应用程序中几乎没有什么不同。对于任何可能需要这个的人:

ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin20 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin19
于 2020-12-08T15:19:14.870 回答
3

我通过 Xcode 修复了它。

$ sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
$ sudo gem install -n /usr/local/bin cocoapods
于 2021-08-18T06:19:03.283 回答
1

这是我能够在 Catalina 10.15.x 上安装 cocoapods 版本 1.10.x 的方式从Apple Developer Downloads
下载命令行工具 11.5(适用于 Catalina)

sudo rm -rf /Library/Developer/CommandLineTools
Install Command Line Tools from .dmg/.pkg
sudo xcode-select --switch /Library/Developer/CommandLineTools
sudo gem install -n /usr/local/bin cocoapods
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
于 2021-07-03T04:04:43.760 回答