LoginSignup
2
1

More than 5 years have passed since last update.

CocoaPodsのインストールで色々ハマった。

Last updated at Posted at 2014-08-16

iOS開発にてKiwiを使って、テストコードを書くために

まずはCocoaPodsをインストールしようとしたのだが、色々ハマったのでメモ。

$ gem install Cocoapods

"/Users/user_name/.rvm/rubies/ruby-1.9.3-p362/bin/ruby" -rubygems /Users/user_name/.rvm/gems/ruby-1.9.3-p362/gems/rake-10.3.1/bin/rake RUBYARCHDIR=/Users/user_name/.rvm/gems/ruby-1.9.3-p362/gems/xcodeproj-0.16.1/ext RUBYLIBDIR=/Users/user_name/.rvm/gems/ruby-1.9.3-p362/gems/xcodeproj-0.16.1/ext
/Users/user_name/.rvm/rubies/ruby-1.9.3-p362/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=/Users/user_name/.rvm/rubies/ruby-1.9.3-p362/bin/ruby
/Users/user_name/.rvm/rubies/ruby-1.9.3-p362/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 /Users/user_name/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:491:in `block in try_compile'
        from /Users/user_name/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:443:in `with_werror'
        from /Users/user_name/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:491:in `try_compile'
        from extconf.rb:24:in `block in <main>'
        from /Users/user_name/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
        from /Users/user_name/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
        from /Users/user_name/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:254:in `open'
        from /Users/user_name/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
        from /Users/user_name/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:254:in `open'
        from /Users/user_name/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
        from /Users/user_name/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
        from extconf.rb:23:in `<main>'
rake aborted!
Command failed with status (1): [/Users/user_name/.rvm/rubies/ruby-1.9.3-p3...]
/Users/user_name/.rvm/gems/ruby-1.9.3-p362/gems/xcodeproj-0.16.1/ext/xcodeproj/Rakefile:37:in `block in <top (required)>'
Tasks: TOP => default => ext
(See full trace by running task with --trace)

You have to install development tools first.

と言われるので、開発ツールが必要らしい。

ここを参考にコマンドを試してみる。

$ xcode-select --install

そこから下記にコマンドをもう一度、試してみる。

$ gem install cocoapods

ダメだ、さっきと同じエラーが起こった。

ここを参考に今度は下のコマンドを試してみる。

$ brew install apple-gcc42
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/apple-gcc42-4.2.1-5666.3.mavericks.bottle.2.tar.gz
######################################################################## 100.0%
==> Pouring apple-gcc42-4.2.1-5666.3.mavericks.bottle.2.tar.gz
==> Caveats
NOTE:
This formula provides components that were removed from XCode in the 4.2
release. There is no reason to install this formula if you are using a
version of XCode prior to 4.2.

This formula contains compilers built from Apple's GCC sources, build
5666.3, available from:

  http://opensource.apple.com/tarballs/gcc

All compilers have a `-4.2` suffix. A GFortran compiler is also included.
==> Summary
?  /usr/local/Cellar/apple-gcc42/4.2.1-5666.3: 104 files, 75M

もう一回チャレンジ。

$ gem install cocoapods

Building native extensions.  This could take a while...
Fetching: cocoapods-try-0.2.0.gem (100%)
Fetching: escape-0.0.4.gem (100%)
Fetching: open4-1.3.3.gem (100%)
Fetching: cocoapods-0.32.1.gem (100%)

CHANGELOG:

## 0.32.1

##### Bug Fixes

* Fixed the Podfile `default_subspec` attribute in nested subspecs.
  [Fabio Pelosin][irrationalfab]
  [#2050](https://github.com/CocoaPods/CocoaPods/issues/2050)


Successfully installed xcodeproj-0.16.1
Successfully installed cocoapods-try-0.2.0
Successfully installed escape-0.0.4
Successfully installed open4-1.3.3
Successfully installed cocoapods-0.32.1
5 gems installed
Installing ri documentation for xcodeproj-0.16.1...
Installing ri documentation for cocoapods-try-0.2.0...
Installing ri documentation for escape-0.0.4...
Installing ri documentation for open4-1.3.3...
Installing ri documentation for cocoapods-0.32.1...
Installing RDoc documentation for xcodeproj-0.16.1...
Installing RDoc documentation for cocoapods-try-0.2.0...
Installing RDoc documentation for escape-0.0.4...
Installing RDoc documentation for open4-1.3.3...
Installing RDoc documentation for cocoapods-0.32.1...

お、うまくいった。
ちゃんと、インストールされているのを確認した。

$ gem list | grep cocoapods
cocoapods (0.32.1)
cocoapods-core (0.32.1)
cocoapods-downloader (0.5.0)
cocoapods-try (0.2.0)
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1