CocoaPods无法使用Xcode 5.0.2进行安装

时间:2023-01-27 10:49:06

I have been stuck on this issue for a couple hours now and I cannot find a solution. I am running Mavericks and have Xcode 5.0.2 installed (which comes with the Command Line Tools).

我已经被困在这个问题上几个小时了,我找不到解决方案。我正在运行Mavericks并安装了Xcode 5.0.2(随命令行工具一起提供)。

My environment:

我的环境:

  • using RVM with ruby version 1.9.3p484
  • 使用RVM与ruby版本1.9.3p484
  • Xcode 5.0.2
  • Xcode 5.0.2
  • Mac OS 10.9.1
  • Mac OS 10.9.1
  • Gem 2.2.0
  • 宝石2.2.0
  • Bundler version 1.3.5
  • Bundler版本1.3.5

Sudo gem install cocoapods outputs

Sudo gem安装cocoapods输出

kyles-mbp-2:fresh-driver-ios kylechronis$ sudo gem install cocoapods
     Building native extensions.  This could take a while...
     ERROR:  Error installing cocoapods:
     ERROR: Failed to build gem native extension.

    /Users/kylechronis/.rvm/rubies/ruby-1.9.3-p484/bin/ruby -rubygems    
    /Users/kylechronis/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rake- 0.9.2.2/bin/rake RUBYARCHDIR=/Users/kylechronis/.rvm/rubies/ruby-1.9.3- p484/lib/ruby/gems/1.9.1/extensions/x86_64-darwin-13/1.9.1/xcodeproj-0.14.1 RUBYLIBDIR=/Users/kylechronis/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/extensions/x86_64-darwin-13/1.9.1/xcodeproj-0.14.1

   /Users/kylechronis/.rvm/rubies/ruby-1.9.3-p484/bin/ruby extconf.rb
   checking for -std=c99 option to compiler... yes
   checking for CoreFoundation... no
   checking for main() in -lCoreFoundation... no
   CoreFoundation is needed to build the Xcodeproj C extension.
    *** 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.

Is this an issue with CoreFoundation not being found? or using a different version of Ruby? Any help or input would be greatly appreciated.

这是CoreFoundation无法找到的问题吗?或者使用不同版本的Ruby?任何帮助或输入将不胜感激。

4 个解决方案

#1


19  

Installing new Ruby version helped me. Follow these steps

安装新的Ruby版本帮助了我。按着这些次序

rvm reinstall ruby-2.0.0-p247 --with-gcc=clang --verify-downloads 1
gem install xcodeproj
gem install cocoapods

I found this answer in some old Github issue.

我在一些旧的Github问题中找到了这个答案。

#2


2  

I ran into this:

我碰到了这个:

http://cocoafactory.com/blog/2013/02/01/troubleshooting-cocoapods-installation/

http://cocoafactory.com/blog/2013/02/01/troubleshooting-cocoapods-installation/

and this:

和这个:

http://railsapps.github.io/installrubyonrails-mac.html

http://railsapps.github.io/installrubyonrails-mac.html

I kinda figured i needed to update something since I was in 1.9.3 i tried updating to 2.1.0. Then I realized I couldn't by doing rvm install ruby. So I did

我想我需要更新一些东西,因为我在1.9.3我尝试更新到2.1.0。然后我意识到我不能通过做rvm安装ruby。所以我做了

sudo gem update --system

sudo gem update --system

that did something which worked, then I was able to run

做了一些有用的东西,然后我就能跑了

rvm install ruby which updated successfully to 2.1.0

rvm install ruby​​,成功更新到2.1.0

Reinstalled cocoa pods btw...and now

重新安装可可豆荚...现在

pod setup has given me Setting up Cocoadpods master repo :)

pod设置给了我设置Cocoadpods主回购:)

#3


0  

http://railsapps.github.io/installrubyonrails-mac.html

http://railsapps.github.io/installrubyonrails-mac.html

and this :

和这个 :

rvm get stable --auto-dotfiles

rvm稳定--auto-dotfiles

did the trick

做了伎俩

#4


0  

i had the identical error messages and spent a lot of time trying all the various answers above and on other sites and other SO pages including:

我有相同的错误消息,并花了很多时间尝试上面和其他网站和其他SO页面上的所有各种答案,包括:

ERROR: Error installing cocoapods: ERROR: Failed to build gem native extension

错误:安装cocoapods时出错:错误:无法构建gem原生扩展

and

http://www.relaxdiego.com/2012/02/using-gcc-when-xcode-43-is-installed.html

http://www.relaxdiego.com/2012/02/using-gcc-when-xcode-43-is-installed.html

and many others

和许多其他人

none of it made any difference

它没有任何区别

i ultimately created a new user on my iMac to see if i could install cocoapods successfully on a pristine install, and it worked beautifully. i checked all the various versions of everything (ruby, gcc) and found they were the same for the new user as for my old user.

我最终在我的iMac上创建了一个新用户,看看我是否可以在原始安装上成功安装cocoapods,并且它工作得很漂亮。我检查了所有各种版本的所有内容(ruby,gcc),发现它们对于新用户和我的旧用户是相同的。

then i realized there were some extra lines added in my ~/.bashrc and ~/.bash_profile files that were there to help set up virtualenv as follows:

然后我意识到我的〜/ .bashrc和〜/ .bash_profile文件中添加了一些额外的行,以帮助设置virtualenv,如下所示:

in .bashrc:

在.bashrc中:

export WORKON_HOME=$HOME/.virtualenvs 
export PROJECT_HOME=$HOME/Desktop/Programming
source /usr/local/bin/virtualenvwrapper.sh

and in .bash_profile:

并在.bash_profile中:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" 

after commenting these lines out and sourcing .bashrc and .bash_profile

在评论这些行并获取.bashrc和.bash_profile之后

$ source ~/.bashrc
$ source ~/.bash_profile

then

然后

$ sudo gem install cocoapods 

worked flawlessly...

完美地工作......

hope this helps someone else in my previously hopeless situation

希望这可以帮助我以前无望的情况

#1


19  

Installing new Ruby version helped me. Follow these steps

安装新的Ruby版本帮助了我。按着这些次序

rvm reinstall ruby-2.0.0-p247 --with-gcc=clang --verify-downloads 1
gem install xcodeproj
gem install cocoapods

I found this answer in some old Github issue.

我在一些旧的Github问题中找到了这个答案。

#2


2  

I ran into this:

我碰到了这个:

http://cocoafactory.com/blog/2013/02/01/troubleshooting-cocoapods-installation/

http://cocoafactory.com/blog/2013/02/01/troubleshooting-cocoapods-installation/

and this:

和这个:

http://railsapps.github.io/installrubyonrails-mac.html

http://railsapps.github.io/installrubyonrails-mac.html

I kinda figured i needed to update something since I was in 1.9.3 i tried updating to 2.1.0. Then I realized I couldn't by doing rvm install ruby. So I did

我想我需要更新一些东西,因为我在1.9.3我尝试更新到2.1.0。然后我意识到我不能通过做rvm安装ruby。所以我做了

sudo gem update --system

sudo gem update --system

that did something which worked, then I was able to run

做了一些有用的东西,然后我就能跑了

rvm install ruby which updated successfully to 2.1.0

rvm install ruby​​,成功更新到2.1.0

Reinstalled cocoa pods btw...and now

重新安装可可豆荚...现在

pod setup has given me Setting up Cocoadpods master repo :)

pod设置给了我设置Cocoadpods主回购:)

#3


0  

http://railsapps.github.io/installrubyonrails-mac.html

http://railsapps.github.io/installrubyonrails-mac.html

and this :

和这个 :

rvm get stable --auto-dotfiles

rvm稳定--auto-dotfiles

did the trick

做了伎俩

#4


0  

i had the identical error messages and spent a lot of time trying all the various answers above and on other sites and other SO pages including:

我有相同的错误消息,并花了很多时间尝试上面和其他网站和其他SO页面上的所有各种答案,包括:

ERROR: Error installing cocoapods: ERROR: Failed to build gem native extension

错误:安装cocoapods时出错:错误:无法构建gem原生扩展

and

http://www.relaxdiego.com/2012/02/using-gcc-when-xcode-43-is-installed.html

http://www.relaxdiego.com/2012/02/using-gcc-when-xcode-43-is-installed.html

and many others

和许多其他人

none of it made any difference

它没有任何区别

i ultimately created a new user on my iMac to see if i could install cocoapods successfully on a pristine install, and it worked beautifully. i checked all the various versions of everything (ruby, gcc) and found they were the same for the new user as for my old user.

我最终在我的iMac上创建了一个新用户,看看我是否可以在原始安装上成功安装cocoapods,并且它工作得很漂亮。我检查了所有各种版本的所有内容(ruby,gcc),发现它们对于新用户和我的旧用户是相同的。

then i realized there were some extra lines added in my ~/.bashrc and ~/.bash_profile files that were there to help set up virtualenv as follows:

然后我意识到我的〜/ .bashrc和〜/ .bash_profile文件中添加了一些额外的行,以帮助设置virtualenv,如下所示:

in .bashrc:

在.bashrc中:

export WORKON_HOME=$HOME/.virtualenvs 
export PROJECT_HOME=$HOME/Desktop/Programming
source /usr/local/bin/virtualenvwrapper.sh

and in .bash_profile:

并在.bash_profile中:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" 

after commenting these lines out and sourcing .bashrc and .bash_profile

在评论这些行并获取.bashrc和.bash_profile之后

$ source ~/.bashrc
$ source ~/.bash_profile

then

然后

$ sudo gem install cocoapods 

worked flawlessly...

完美地工作......

hope this helps someone else in my previously hopeless situation

希望这可以帮助我以前无望的情况