Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't get CocoaPods working

I installed CocoaPods and it says Successfully installed cocoapods-0.33.1, but whatever I would try to do with pod command, like pod install, I get the following console output:

Max$ pod install
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin14/rbconfig.rb:213: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- xcodeproj/prebuilt/universal.x86_64-darwin14-2.0.0/xcodeproj_ext (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/lib/xcodeproj/ext.rb:6:in `rescue in <top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/lib/xcodeproj/ext.rb:3:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/lib/xcodeproj.rb:30:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/lib/cocoapods.rb:2:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/bin/pod:32:in `<top (required)>'
from /usr/bin/pod:23:in `load'
from /usr/bin/pod:23:in `<main>'

I am using Mac OS 10.10 (Yosemite beta version) and Xcode 6.0 beta2, but I think back when I used Mavericks and Xcode 5.1.1 I had the same problem.

like image 238
Maxim Chetrusca Avatar asked Dec 05 '22 06:12

Maxim Chetrusca


2 Answers

I finally solved my problem.

Short answer:

I had to install ruby 2.1.2, then reinstall cocoapods and everything worked.

Long answer:

  1. Resolve all warnings from brew doctor;
    • remove unused libraries;
    • remove MacPorts;
    • resolve additional warnings which I already do not remember;
    • I might even reinstalled brew.
  2. Install rvm;
  3. Install & use ruby 2.1.2 using rvm;
    • rvm requirements complains about many missing packages, install them;
    • among them, there is gcc46, which I was unable to install. After Xcode 4.2 or something, command line tools come without gcc. So if rvm requirements does not find one, it suggests gcc46. But the point is, installing brew install apple-gcc42 solves the problem. rvm requirements stops complaining and you can install ruby 2.1.2:
    • rvm install 2.1.2;
    • rvm use 2.1.2;
  4. Install cocoapods, as suggested in @Varsha Vijayvargiya's answer.

I might forgot something, so if you have any questions - ask. Here are some links which helped me:

  • update mac osx to 10.10 and pod cannot work;
  • Installing Ruby 2.0.0 with RVM and Homebrew on Mac OS X 10.8 Mountain Lion;
  • Homebrew GCC won't install on OS X 10.10 Yosemite with Xcode 6;
  • Installing gcc on Mavericks.
like image 56
Maxim Chetrusca Avatar answered Dec 23 '22 18:12

Maxim Chetrusca


-- Open Xcode 6

-- Open Preferences

-- click on Locations tab

-- Change the Command Line Tools version to Xcode 6.0

-- Uninstall cocoapods

    $ sudo gem uninstall cocoapods

-- Install xcodeproj

     $ sudo gem install xcodeproj

-- Install cocoapods

     $ sudo gem install cocoapods

-- Run pod.

like image 36
Varsha Vijayvargiya Avatar answered Dec 23 '22 17:12

Varsha Vijayvargiya