pod install -bash: pod: command not found

后端 未结 21 2748
野的像风
野的像风 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:38

    so I also had the same problem. This is probably happening because your computer has an older version of ruby. So you need to first update your ruby. Mine worked for ruby 2.6.3 version.I got this solution from sStackOverflow,

    You need to first open terminal and put this code

    curl -L https://get.rvm.io | bash -s stable
    

    Then put this command

    rvm install ruby-2.6
    

    This would install the ruby for you if it hasn' t been installed.After this just update the ruby to the new version

    rvm use ruby-2.6.3
    

    After this just make ruby 2.6.3 your default

    rvm --default use 2.6.3
    

    This would possibly fix your issue. You can now put the command

    sudo gem install cocoapods
    

    And the command

    pod setup
    

    I hope this was useful

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

    You have to restart Terminal after installing the gem. Or you can simply open a new tab Terminal to fix.

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

    gterzian is on the right track, however, if you later update your version of ruby then you'll also have to update your .profile to point to the new versioned ruby directory. For instance, the current version of ruby is 2.0.0-p353 so you'd have to add /usr/local/Cellar/ruby/2.0.0-p353/bin to your path instead.

    A better solution is to add /usr/local/opt/ruby/bin to your PATH. /usr/local/opt/ruby is actually a symlink to the current version of ruby that homebrew automatically updates when you do an upgrade. That way you'll never need to update your PATH and always be pointing to the latest version.

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

    For macOS:

    brew install cocoapods
    brew cask install cocoapods-app
    
    0 讨论(0)
  • 2020-11-28 19:45
    1. Uninstall all instances of cocopods by this command

      $sudo gem uninstall cocoapods
      
    2. sudo gem install -n /usr/local/bin cocoapods

    3. sudo chmod +rx /usr/local/bin/

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

    If you used homebrew to install ruby, this answer worked for me.

    brew unlink ruby && brew link ruby

    OSX 10.9.4

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