To run pod install
as a pre-build action for your target using RVM, follow these easy steps.
- Duplicate your main scheme, and make sure it's shared
- Navigate to the Edit Build section of your new scheme
- Uncheck
Find Implicit Dependencies
(otherwise Xcode will stop the build when the workspace contents change) - Go into the Pre-actions subsection
- Add a new run script with the following content:
source "$HOME/.rvm/scripts/rvm"
rvm use ruby-1.9.3-p194 # whichever version of Ruby you installed the cocoapods gem to
cd ${SRCROOT}
pod install
- Change the
Shell
to/usr/bin/env bash
and make sure to Provide Build Settings from your target - Click OK
- Switch to the new scheme, and build!
I'm using the system Ruby. No, we do not check Pods or .xcworkspace into source control, they are both generated by the CocoaPods tool at pod install time.