[Etc IOS LIB] ERROR: Error installing cocoapods: ERROR: Failed to build gem native extension

 

I am trying to install cocoapods to my MacBook Pro running with OSX 10.9.1 (new Mavericks) and after type gem install cocoapods I get the following error:

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

        "/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby" -rubygems /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-10.1.1/bin/rake RUBYARCHDIR=/Users/rangreenberg/gems/gems/xcodeproj-0.14.1/ext RUBYLIBDIR=/Users/rangreenberg/gems/gems/xcodeproj-0.14.1/ext
/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for -std=c99 option to compiler... *** 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.

Provided configuration options:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby
/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:491:in `block in try_compile'
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:443:in `with_werror'
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:491:in `try_compile'
    from extconf.rb:24:in `block in <main>'
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
    from extconf.rb:23:in `<main>'
rake aborted!
Command failed with status (1): [/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/...]

Tasks: TOP => default => ext
(See full trace by running task with --trace)


Gem files will remain installed in /Users/rangreenberg/gems/gems/xcodeproj-0.14.1 for inspection.
Results logged to /Users/rangreenberg/gems/gems/xcodeproj-0.14.1/ext/xcodeproj/gem_make.out
  •  
    Try to switch ruby to homebrew version. brew install ruby brew link --overwrite ruby If you need to have ruby first in your PATH run: echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile For compilers to find ruby you may need to set: export LDFLAGS="-L/usr/local/opt/ruby/lib" export CPPFLAGS="-I/usr/local/opt/ruby/include" For pkg-config to find ruby you may need to set: export PKG_CONFIG_PATH="/usr/local/opt/ruby/lib/pkgconfig"   Nov 9, 2021 at 12:26 

40 Answers

602
 

Run following command

 brew cleanup -d -v 

Then run below command

brew install cocoapods 

Note: If you see failed to link then run brew link cocoapods

If linking is getting failed then run

경축! 아무것도 안하여 에스천사게임즈가 새로운 모습으로 재오픈 하였습니다.
어린이용이며, 설치가 필요없는 브라우저 게임입니다.
https://s1004games.com

brew link --overwrite cocoapods

This is how it get solved for me

For someone who is having m1 chip system they need to run this via Rosetta

select Terminal and press cmd(⌘)+I and check the "Open using Rosetta" option. ( For m1 chip based mac )

 

[출처] https://stackoverflow.com/questions/20939568/error-error-installing-cocoapods-error-failed-to-build-gem-native-extension

본 웹사이트는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
번호 제목 글쓴이 날짜 조회 수
» [Etc IOS LIB] ERROR: Error installing cocoapods: ERROR: Failed to build gem native extension file 졸리운_곰 2024.04.12 278
15 [아이폰 앱 개발] [iOS / Error] Failed to render and update auto layout... 에러 해결 file 졸리운_곰 2024.03.29 170
14 [mac c/c++] M1 맥북 vscode C/C++ 개발환경 세팅 file 졸리운_곰 2024.01.07 204
13 [apple IOS] 개발/iOS 기기없이 빌드 아카이브 생성하기 file 졸리운_곰 2023.10.01 152
12 [아이폰 앱 개발] [flutter 설치시] sudo gem install cocoapods 에러시 error 졸리운_곰 2023.04.09 140
11 [아이폰 앱 개발] [AppStore] 앱스토어에 앱 등록하는 방법을 모르겠다. file 졸리운_곰 2023.03.26 179
10 [아이폰 앱 개발] Swift) Localizing - 다국어 처리하기 file 졸리운_곰 2023.03.21 222
9 [아이폰 앱 개발] Creating A Simple Web View App For iOS file 졸리운_곰 2023.03.21 212
8 [아이폰 앱 개발] Swift, Objective-C, C++ 같이 사용하기 file 졸리운_곰 2021.11.21 316
7 [swift ios] Inject JavaScript into WKWebView : webview에 javascript 삽입 졸리운_곰 2021.05.15 304
6 [SWIFT, IOS] [SWIFT] 웹뷰와 자바스크립트 연동 (Native <-> JavaScript 통신 방법) file 졸리운_곰 2021.05.14 178
5 [SWIFT, IOS] [SWIFT] WKWebview 쿠키, 세션, 로컬스토리지 등 웹 데이터 삭제 및 값 얻어오기 file 졸리운_곰 2021.05.14 501
4 Emscripten 가지고 놀기 1. (feat. CodeLite) file 졸리운_곰 2018.12.01 306
3 How To Make an App For Your Website In Less Than 30 Minutes file 졸리운_곰 2018.09.03 412
2 chartboost 란 : 앱의 광고 모듈으로써... file 졸리운_곰 2014.12.01 740
1 Objective - C 의 요약정리문서 - 박종암 저 file 졸리운_곰 2014.05.31 737
대표 김성준 주소 : 경기 용인 분당수지 U타워 등록번호 : 142-07-27414
통신판매업 신고 : 제2012-용인수지-0185호 출판업 신고 : 수지구청 제 123호 개인정보보호최고책임자 : 김성준 sjkim70@stechstar.com
대표전화 : 010-4589-2193 [fax] 02-6280-1294 COPYRIGHT(C) stechstar.com ALL RIGHTS RESERVED