MacOSX
Gem
CocoaPods

High sierraでCocoapodsがインストールできなかったのを解消

tl;dr

sudo gem install cocoapods -n /usr/local/binしような。

概要

macOSX Highsierra上にて、sudo gem upgrade --systemして、sudo gem install cocoapodsでインストールしようとしたところ失敗したのでなんとかした。

詳細

$ sudo gem install cocoapods
Fetching: concurrent-ruby-1.0.5.gem (100%)
Successfully installed concurrent-ruby-1.0.5
Fetching: i18n-0.9.0.gem (100%)
Successfully installed i18n-0.9.0
Fetching: thread_safe-0.3.6.gem (100%)
Successfully installed thread_safe-0.3.6
Fetching: tzinfo-1.2.3.gem (100%)
Successfully installed tzinfo-1.2.3
Fetching: activesupport-4.2.10.gem (100%)
Successfully installed activesupport-4.2.10
Fetching: nap-1.1.0.gem (100%)
Successfully installed nap-1.1.0
Fetching: fuzzy_match-2.0.4.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /usr/bin directory.

えー‥‥。
現象的にはこれ(Stackoverflow)に近い。

なので、アドバイス通り

$ sudo gem install cocoapods -n /usr/local/bin
Successfully installed fuzzy_match-2.0.4
Fetching: cocoapods-core-1.3.1.gem (100%)
Successfully installed cocoapods-core-1.3.1
Fetching: claide-1.0.2.gem (100%)
Successfully installed claide-1.0.2
Fetching: cocoapods-deintegrate-1.0.1.gem (100%)
Successfully installed cocoapods-deintegrate-1.0.1
Fetching: cocoapods-downloader-1.1.3.gem (100%)
.
.
.

(snip)

.
.
.

Parsing documentation for gh_inspector-1.0.3
Installing ri documentation for gh_inspector-1.0.3
Parsing documentation for ruby-macho-1.1.0
Installing ri documentation for ruby-macho-1.1.0
Parsing documentation for cocoapods-1.3.1
Installing ri documentation for cocoapods-1.3.1
Done installing documentation for fuzzy_match, cocoapods-core, claide, cocoapods-deintegrate, cocoapods-downloader, cocoapods-plugins, cocoapods-search, cocoapods-stats, netrc, cocoapods-trunk, cocoapods-try, molinillo, CFPropertyList, colored2, nanaimo, xcodeproj, escape, fourflusher, gh_inspector, ruby-macho, cocoapods after 8 seconds
21 gems installed

にて、うまく行ったもよう。ちなみに、gem install -nの-nオプションはバイナリファイルを置く場所を指定するということ

参考