Search code examples
rubyrubygemscocoapodsrbenv

How to switch cocoapods (or other gem) version on command line?


There are some answers saying using gem 'cocoapods', '0.33.1' or gem 'pod', '0.33.1

but this does not work.

ERROR: While executing gem ... (Gem::CommandLineError) Unknown command cocoapods,

In one project I need to use 0.33.1, but 0.34.4 in another. How do I switch the cocoapods version quickly on command line? I don't want to use gem install or uninstall.

I am using rbenv with ruby version 2.0.0p0. Keep using rbenv is preferred but I can switch to rvm or pure ruby only if there is no other options.

Thanks.


Solution

  • You can do the following to use different versions:

    pod _0.34.4_ install 
    

    or

    pod _0.34.1_ install