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

6

24

I am trying to install gem install travis to use travis-cli as per reference https://rubygems.org/gems/travis but getting below error.

Tried solution mentioned here 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 */

Any help will be appreciated! try finding out but didn't find helpful

Coronagraph answered 29/8, 2020 at 18:52 Comment(2)
Would you please accept my answer if you see it's correct?Sower
Dec 29, 2022 - Awesome Answer! What a pain CocoaPods is, homebrew, ruby, gem.Renin
S
64

This will do the trick

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

Latest CocoaPods 1.10.0 won't work.

Update!

if you want to instal CocoaPods 1.10.0 + you can use HomeBrew and then enter the below in command line

brew install cocoapods
Sower answered 26/1, 2021 at 13:52 Comment(4)
confirmed as of 5 mins ago, props! also I needed 1.9.x, so i had to follow this.Maybellemayberry
this worked like smoother than anything else. Thanks @AlshcompilerCoronagraph
HomeBrew worked great. They should offer this solution on their website.Pennebaker
Hats off Bro ! I am having Macbook Air 2020 withe xCode 13.1 and was getting the error as below. "Building native extensions. This could take a while..." ERROR: Error installing cocoapods: ERROR: Failed to build gem native extension. "brew install cocoapods" work like a charm. Saved my day ! Thank you so much.Queensland
F
7

I had the same problem. I noticed the files are searched in

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

I had installed XCode 12.2 with its command line tools which didn't have that folder but universal-darwin20. I solved it by soft linking that folder to universal-darwin16.

From terminal:

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

Fibrinolysis answered 17/11, 2020 at 7:45 Comment(2)
let me try this. ThanksCoronagraph
How did you find your universal-darwin version?Hispanicize
C
5

Thanks to the previous response who symlinked the universal-darwin I figured out the location on mine was little different within Xcode app. For anyone who might need this:

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
Cerium answered 8/12, 2020 at 15:19 Comment(2)
This fixed it for me (I had to figure out what my actual directory was, but it did the trick after that). Thank you so much!Hiroshima
It worked for me too.Gesualdo
I
5

This worked for me

brew install cocoapods
Indictable answered 18/3, 2022 at 5:8 Comment(0)
S
3

This is the way I was able to install cocoapods verion 1.10.x on Catalina 10.15.x
Download Command Line Tools 11.5 (works on Catalina) from Apple Developer Downloads

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
Subsist answered 3/7, 2021 at 4:4 Comment(1)
I still needed to create a symlink like some other answers suggested. macOS Ventura would not allow a symlink to be created within the Xcode package contents even using sudo, so installing and switching to the command line tools and then creating the symlink there did the trick.Crypt
A
3

I fixed it by Xcode.

$ sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
$ sudo gem install -n /usr/local/bin cocoapods
Artema answered 18/8, 2021 at 6:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.