0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

🚀 MacにCocoaPodsをインストール

Last updated at Posted at 2025-04-06

CocoaPodsは、iOSやMac向けのアプリ開発において、ライブラリを管理するためのパッケージマネージャーです。

GitHub などからライブラリを自動で取得・管理できるため、ライブラリの導入・更新が簡単になり、開発効率が向上します。

1. CocoaPods がインストールされているか確認

まずは CocoaPods がすでにインストールされているか確認しましょう。

pod --version

バージョンが表示されればインストール済みです。
表示されない場合は、次の方法でインストールしましょう。

2. CocoaPods のインストール方法(2通り)

✅ 方法 A:gem(RubyGems)でインストールする場合

RubyGems を使ってインストールします。
Ruby 環境に慣れている方向けです。

sudo gem install cocoapods

📌 注意:PATHを通す必要があります

pod コマンドが not found になる場合は、PATH が通っていない可能性があります。

以下のコマンドで確認:

echo $PATH | grep '.gem/bin'

何も表示されなければ、以下を ~/.zshenv(または ~/.zshrc)に追記:

export PATH=$HOME/.gem/bin:$PATH

反映するには:

exec $SHELL -l

再確認:

pod --version

✅ 方法 B:Homebrew でインストールする(推奨)

特に Flutter を使用する場合や、M1/M2 Mac では Homebrew 経由の方が安定することが多いため、こちらをおすすめします。

brew install cocoapods

インストール完了後に確認:

pod --version

おまけ:pod repo update

初回や久しぶりに CocoaPods を使うときは、リポジトリの更新をしておくと安心です。

pod repo update

これで CocoaPods のインストールは完了です✨

Xcode や Flutter のプロジェクトで pod install を使って、ライブラリ管理を快適にしましょう!

0
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?