pod install -bash: pod: command not found

后端 未结 21 2749
野的像风
野的像风 2020-11-28 19:06

I installed pod some time ago. However, it\'s stopped working so I\'m working through this again.

However, I almost immediately run into a problem here:

相关标签:
21条回答
  • 2020-11-28 19:47

    Installing CocoaPods on OS X 10.11

    These instructions were tested on all betas and the final release of El Capitan.

    Custom GEM_HOME

    This is the solution when you are receiving above error

    $ mkdir -p $HOME/Software/ruby
    $ export GEM_HOME=$HOME/Software/ruby
    $ gem install cocoapods
    [...]
    1 gem installed
    $ export PATH=$PATH:$HOME/Software/ruby/bin
    $ pod --version
    0.38.2
    
    0 讨论(0)
  • 2020-11-28 19:47

    I had the same problem, running Mountain Lion with Ruby 2 installed and used instead of system ruby.

    Previously I added PATH=/usr/local/bin:$PATH to my ~/.bash_profile as a way to make sure stuff installed by homebrew, including Ruby 2, took precedence over system-installed binaries.

    Anyway, in this case I noticed that cocoapods would install their 'pod' binary not in /usr/local/bin but rather in /usr/local/Cellar/ruby/2.0.0-p247/bin/

    So to my .bash_profile I added PATH=$PATH:/usr/local/Cellar/ruby/2.0.0-p247/bin/ and now cocoapods is working like a charm.

    0 讨论(0)
  • 2020-11-28 19:48

    Sudo-less installation

    If you do not want to grant RubyGems admin privileges for this process, you can tell RubyGems to install into your user directory by passing either the --user-install flag to gem install or by configuring the RubyGems environment. The latter is in our opinion the best solution. To do this, create or edit the .profile file in your home directory and add or amend it to include these lines:

    export GEM_HOME=$HOME/.gem
    export PATH=$GEM_HOME/bin:$PATH
    

    Note that if you choose to use the --user-install option, you will still have to configure your .profile file to set the PATH or use the command prepended by the full path. You can find out where a gem is installed with gem which cocoapods. E.g.

    $ gem install cocoapods --user-install
    $ gem which cocoapods
    /Users/eloy/.gem/ruby/2.0.0/gems/cocoapods-0.29.0/lib/cocoapods.rb
    $ /Users/eloy/.gem/ruby/2.0.0/bin/pod install
    

    Source: https://guides.cocoapods.org/using/getting-started.html

    0 讨论(0)
  • 2020-11-28 19:50

    @Babul Prabhakar was right

    IMPORTANT: However,if you still get "pod: command not found" after using his solution, this command could solve your problem:

    sudo chown -R $(whoami):admin /usr/local
    
    0 讨论(0)
  • 2020-11-28 19:54

    try: rbenv global system and then sudo gem install cocoapods pod setup

    0 讨论(0)
  • 2020-11-28 19:54

    install cocoapods from https://cocoapods.org/app

    Commands & versions keep onchanging

    so download tar and enjoy

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