podenv allows you to easily install, and switch between multiple versions of CocoaPods, without managing Ruby.
podenv allows you to:
- Change the global CocoaPods version, per user.
- Set a per-project CocoaPods version.
- Allows you to override the CocoaPods version with an environmental variable.
You can install podenv using the Homebrew package manager.
$ brew install kylef/formulae/podenv
-
Check out podenv, we recommend
~/.podenv
(but it can be installed elsewhere as long as you setPODENV_ROOT
).$ git clone https://github.com/kylef/podenv.git ~/.podenv
-
Configure environment.
For Bash:
$ echo 'export PATH="$HOME/.podenv/bin:$PATH"' >> ~/.bash_profile
For ZSH:
$ echo 'export PATH="$HOME/.podenv/bin:$PATH"' >> ~/.zshenv
For Fish:
$ echo 'setenv PATH "$HOME/.podenv/bin" $PATH' >> ~/.config/fish/config.fish
-
Restart your shell so the changes take effect.
Once you've installed podenv, you can install a specific version of CocoaPods using the install command:
$ podenv install 1.0.0.beta.2
Alternatively, you can install the version specified in the local Podfile.lock
file using the following:
$ podenv install
Then you can continue to use CocoaPods as you normally would, podenv which automatically switch to the correct version locked from your Podfile.lock
when you run it.
$ pod --version
1.0.0.beta.2
Displays the current active CocoaPods version and why it was chosen.
$ podenv version
0.39.0 (set by Podfile.lock)
Lists all installed CocoaPods versions, showing an asterisk next to the currently active version.
$ podenv versions
* 0.39.0 (set by Podfile.lock)
1.0.0.beta.2
Sets the global version of CocoaPods to be used by writing to the
~/.podenv/version
file. This version can be overridden by
application-specific Podfilefile, or by setting the COCOAPODS_VERSION
environment variable.
$ podenv global 1.0.0.beta.2
$ podenv global
1.0.0.beta.2
Installs a version of CocoaPods.
$ podenv install 1.0.0.beta.2
$ podenv install --list
1.0.0.beta.2
1.0.0.beta.1
0.39.0
0.39.0.rc.1
...
It's also possible to install directly from a branch found on the CocoaPods repository:
$ podenv install --branch 0.39-stable
The version inside podenv will be the branch name, for example 0.39-stable
.
You can explicitly use this version via the environ variable, for example:
$ env COCOAPODSPOD_VERSION=0.39-stable pod
NOTE: You may also use --repo
to install from a different GitHub
remote.
Uninstalls a specific CocoaPods version.
$ podenv uninstall 1.0.0.beta.2
Runs an executable with the selected CocoaPods version. For example, this can be used to install CocoaPods plugins.
$ podenv exec gem install cocoapods-bugsnag