Use sudo for gem install cocoapods

前端 未结 4 778
鱼传尺愫
鱼传尺愫 2020-12-31 07:11

When I run

$ gem install cocoapods

I get

Fetching: i18n-0.7.0.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissi         


        
相关标签:
4条回答
  • 2020-12-31 07:31

    It seems you are not using any package manager. Since, you don't have write permission to this directory, there is nothing wrong in using sudo for gem install.

    However, I prefer changing ownership of that directory, so that I don't have to use sudo every time.
    i.e. sudo chown -R [login name] /Library/Ruby/Gems/2.0.0

    and ensure that I have write permission. sudo chmod -R u+w /Library/Ruby/Gems/2.0.0

    Consider using rvm (ruby version manager) or rbenv

    0 讨论(0)
  • 2020-12-31 07:33
     sudo gem install cocoapods
    

    works for me

    0 讨论(0)
  • 2020-12-31 07:36

    This is the solution when you are receiving the "Operation not permitted" error.

    $ mkdir -p $HOME/Software/ruby
    $ export GEM_HOME=$HOME/Software/ruby
    $ gem install cocoapods
    [...]
    
    0 讨论(0)
  • 2020-12-31 07:42

    You need to 'update Gems'. Open terminal, then do this

    sudo gem update
    

    That's enough.

    0 讨论(0)
提交回复
热议问题