安装 travis-cli 时在 macOS 中找不到 libffi 的包配置

package configuration for libffi is not found in macOS while installing travis-cli

我正在尝试安装 gem install travis 以根据参考资料 travis-cli 使用 travis-cli 但出现以下错误。

尝试过这里提到的解决方案 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

package configuration for libffi is not found "xcrun clang -o conftest -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin16 -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby/backward -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -g -Os -pipe -DHAVE_GCC_ATOMIC_BUILTINS -iwithsysroot /usr/local/libressl/include conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib -L. -L /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.Internal.sdk/usr/local/libressl/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.Internal.sdk/usr/local/lib -arch x86_64 -arch i386 -lruby.2.3.0 -lpthread -ldl -lobjc " In file included from conftest.c:1: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.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: fatal error: 'ruby/config.h' file not found #include "ruby/config.h" ^~~~~~~~~~~~~~~ 1 error generated. checked program was: /* begin */ 1: #include "ruby.h" 2: 3: int main(int argc, char *argv) 4: { 5: return 0; 6: } / end */

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

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

中搜索

/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 及其命令行工具,它没有那个文件夹,但有 universal-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

感谢之前对 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

这样就可以了

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

最新的 CocoaPods 1.10.0 将无法运行。

更新!

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

brew install cocoapods

这是我能够在 Catalina 10 上安装 cocoapods 版本 1 的方法。10.x。15.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

我通过 Xcode 修复了它。

$ sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
$ sudo gem install -n /usr/local/bin cocoapods

这对我有用

brew install cocoapods