Cannot install CocoaPods in macOS sierra

When I trying to install the cocoapods rubygem (sudo gem install cocoapods),I got this error.

ERROR:  While executing gem ... (Errno::EPERM)
  Operation not permitted - /usr/bin/pod

I'm using an administrator account, how would I go about fixing permissions?
'pod' is not exist in /usr/bin,and I cannot touch podin /usr/bin,because the Security features of OS X.
So I tried specifying a new bin directory throughsudo gem install -n /usr/local/bin cocoapods but that didn't solve my problem.

Cannot install CocoaPods in macOS sierra_第1张图片
52C8D84C-3442-42FD-AF6E-2F4304422313.png

I have successfully installed cocoapods.But I got this error.pod: command not foundBecause my $PATH is not right .

And how to modify the Shell path in macOS Sierra using terminal ?

Rearranging the default path.

Move into the home directory nano .bash_profile Create the **.bash_profile ** file with a command line editor called nano export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Cannot install CocoaPods in macOS sierra_第2张图片
osx-path-modify1.png

Save the file in nano by clicking ‘control’ +’o’ and confirming the name of the file is .bash_profile by hitting return.
And the ‘control’+’x’ to exit nano .
So now when the Terminal is relaunched or a new window made and you check the the path by 'echo $PATH' .
You will get a new path .
Then run 'pod setup'

你可能感兴趣的:(Cannot install CocoaPods in macOS sierra)