20
18

More than 5 years have passed since last update.

Cocoapods のインストール(Mac OS X 10.10.1 Yosemite)

Last updated at Posted at 2014-12-02

この記事は、Xcode ,Swift ,Cocoapods ,の初心者が、Cocoapodsのインストールでハマった際の手順をまとめたものです! ;)

RubyGemsのアップデート

*2014/12/02 時点で、"sudo gem install cocoapods" に対して以下のエラーがあった。

ERROR:  Could not find a valid gem 'cocoapods' (>= 0), here is why:
          Unable to download data from https://rubygems.org/ - no such name (https://rubygems.org/quick/Marshal.4.8/cocoapods-0.35.0.gemspec.rz)
ERROR:  Possible alternatives: cocoapods

そこで、RubyGems の最新を入れるために以下の操作をした。

コンソールより、以下を実行した。

sudo gem update --system
sudo gem install rubygems-update
sudo update_rubygems 

結果、以下のようにイストールされた。

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/gem

Cocoapods のインストール

この状態で、cocoapodsのインストールを実施した。

sudo gem install cocoapods

Fetching: nap-0.8.0.gem (100%)
Successfully installed nap-0.8.0

...

Parsing documentation for cocoapods-0.35.0
Installing ri documentation for cocoapods-0.35.0
20 gems installed

無事にインストールされたようである。

Cocoapods で扱うライブラリの情報をセットアップする。

pod setup
Setting up CocoaPods master repo
Setup completed

*参照記事:
iOSライブラリ管理の神ツール「CocoaPods」のインストールと使い方 (1/2)

cocoapods で、ライブラリのインストールを実施すると autoconf がないなどのエラーが出るので、以下を実行した。

Xcode commandline toolのインストール

command_line_tools_for_osx_10.10_for_xcode_6.1.1_gm_seed のインストール

  1. XCodeのメニューから、「Xcode」-「Open Developer Tool」-「More Developer Tools」を選択する。
  2. ブラウザが起動してApple Developerが表示されるので、その中から「command_line_tools_for_osx_10.10_for_xcode_6.1.1_gm_seed」を選択しダウンロード。
  3. command_line_tools_for_osx_10.10_for_xcode_6.1.1_gm_seed.dmg をマウントし、"Command Line Tools (OS X 10.10).pkg" をインストールする

Homebrew のインストール

Homebrew のインストール
以下のコマンドを実施。

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
・・・
==> Installation successful!
==> Next steps
Run `brew doctor` before you install anything
Run `brew help` to get started

brew doctor

結果として以下が返された。


Warning: You have MacPorts or Fink installed:
  /opt/local/bin/port

This can cause trouble. You don't have to uninstall them, but you may want to
temporarily move them out of the way, e.g.

  sudo mv /opt/local ~/macports

MacPorts をインストールしたかが定かではないが、/opt/local/bin/port が存在した。そのため、以下を実行して Homebrew の環境に合わせるようにした。

  sudo mv /opt/local ~/macports

再度、brew doctor を実行したところ、以下になった。

Your system is ready to brew.

autoconf , automake のインストール

brew install autoconf
brew install automake

pods のインストール

podsfileに、以下を記述した。

platform :ios, "6.0"
pod 'SpatialDBKit'

*SpatialDBKit は、地理情報関連のライブラリです。

pod install

を実施したところ、エラーもなくライブラリのインストールができました。

20
18
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
20
18