【備忘録】CocoaPodsが更新できない時
pods updateができなかったので・・・
$ [sudo] gem update cocoapodsこれだと以下のエラーがでました。
extconf failed, exit code 1 
Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/ffi-1.16.3 for inspection. Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-21/2.6.0/ffi-1.16.3/gem_make.out
で、以下の手順で環境を整えました。
■STEP1:Homebrewのインストール
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"■STEP2:Rubyのインストール
brew install rubyここで謎のメッセージがでた。
You may want to add this to your PATH. ruby is keg-only, which means it was not symlinked into /usr/local, because macOS already provides this software and installing another version in parallel can cause all kinds of trouble. If you need to have ruby first in your PATH, run: echo ‘export PATH=”/usr/local/opt/ruby/bin:$PATH”‘ >> ~/.zshrc For compilers to find ruby you may need to set: export LDFLAGS=”-L/usr/local/opt/ruby/lib” export CPPFLAGS=”-I/usr/local/opt/ruby/include”
どうやらPATHの設定が必要とのこと。
■STEP3:PATHの設定
ターミナルに次のコマンドを入力して、~/.zshrc ファイルを開きます。
nano ~/.zshrc
ファイルが開いたら以下を追加
export PATH="/usr/local/lib/ruby/gems/3.3.0/bin:$PATH"
export PATH="/usr/local/opt/ruby/bin:$PATH"追加後「control + O」で保存、Enter キーを押して確認します。その後、Ctrl + X キーを押してエディタを終了します。
最後に以下で反映
source ~/.zshrc■STEP4 CocoaPodsをインストール
sudo gem install cocoapodsインストールが完了したら、次のコマンドを入力してCocoaPodsのバージョンを確認します。
pod --version■STEP5 プロジェクトのディレクトリに移動
Podfileを入れているアプリのフォルダに移動します。
※パスは右クリック後に「option」を押すと「パス名をコピー」がでるはず!
cd //■STEP6 pod install
※Podfileがない時はpod initでPodfileを生成
pod installこれで、完了!
Pod installation complete! There are 3 dependencies from the Podfile and 8 total pods installed.
そういえば最後はpod updateでもよかったかも・・・?
まあそれはまた今度試します。

