LoginSignup
0
1

More than 3 years have passed since last update.

CocoaPods Version Update時に発生したライトプロテクション関連エラーの回避方法!

Last updated at Posted at 2020-11-25

事象

CocoaPodsのバージョンが古くインストールできないPodがあったため、CocoaPodsをアップデートしようとしたら、エラー発生!!以下のエラーの解決法法を紹介します。

※今回のリサーチでわかった解決方法は以下の通りですが、なにか他に方法がありましたら教えてください。

You don't have write permissions for the /usr/bin directory

事象発生までの流れ

Cocoapodsのバージョンをアップデートしよう以下のコマンドを実行

$ sudo gem uninstall cocoapods

エラー発生

/usr/bin directory.に書き込む権限がないらしい。

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /usr/bin directory.

理由

Catalinaでは、Systemファイルにはライトプロテクトがかかっており、書き込みや削除ができない。

引用:
"Catalina has a new file system arrangement where most of the system files are write-protected. Apple uses two partitions, a read-only one for the main system files and a writeable one for other files, and melds them together and presents them as one to the user.
[For details see the WWDC video What's New in Apple Filesystems]"(https://developer.apple.com/videos/play/wwdc2019/710/#,"")

解決方法

$ sudo gem install cocoapods -n /usr/local/bin

"-n"は、既存のファイルを上書きしないという意味。これでライトプロテクトを回避できるのか!

Screen Shot 2020-11-25 at 4.56.24 PM.png
出典:【 mv 】コマンド――ファイルやディレクトリを移動する/名前を変更する

pod setupはしなくてみいいみたいです。

$ pod setup

引用:
"Yes that is intended. The current 1.8.0 pod setup does not do anything and we have kept it if we need it in the future and to avoid breaking systems that depend on it.

I can keep this open with a tiny enhancement that prints out a message the "Setup completed successfully." or something."
Cocoapods GitHub: No output from pod setup #9184

参考文献

1.CocoaPodsのバージョンアップの方法
2.You don't have write permissions for the /usr/bin directory. while installing Cocoapods
3.SIP is disabled, but /usr/bin is write protected anyway (macOS Catalina beta 10.5)

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