If anybody stumbles across this from Google, I found that the simplest thing to do was:
Have devs install rbenv
on their machines, and add ~/.rbenv/shims
to the PATH in the XCode build script like:
export PATH=~/.rbenv/shims:$PATH
# Exec rest of your script
# ...
A slightly more complicated, but more customizable solution is to have your script start with the following:
XCODE_ENV=.xcode-env
XCODE_LOCAL_ENV=.xcode-env-local
# Setup your env variable overrides here
if [ -f $XCODE_LOCAL_ENV ]; then
source $XCODE_LOCAL_ENV
fi
# Source default environment variables
source $XCODE_ENV
# Exec rest of your script
# ...
The .xcode-env
file contains:
#
# Default XCode ENV
#
# Set RBENV_SHIMS if undefined
if [ -z $RBENV_SHIMS ]; then
RBENV_SHIMS=~/.rbenv/shims
fi
export PATH=$RBENV_SHIMS:$PATH
So, if you want to specify alternative environment variables, you can create a .xcode-env-local
(which is gitignored) with content like:
RBENV_SHIMS=/some/other/path/to/.rbenv/shims
It worked for me! Thanks!
https://gist.github.com/acevif/c67149aaabab3bb0f6e733782619842c