Take the 2-minute tour ×

Outside of Xcode I use a specific version of Ruby, using RVM to manage multiple Ruby installations.

Apple's command line dev tools install Ruby at /usr/bin/ruby and is version 1.8.7.

I use 1.9.3 through RVM.

Is there a way to force Xcode to use my 1.9.3 installation when running its Run Script build phases?

I already tried setting the Shell path to the full path of my specific Ruby, but that didn't seem to make a difference, by which I mean that the particular Gems I have installed in my 1.9.3 weren't available/visible to the script when run within Xcode.

If I run my project through xcodebuild on the command line, the Run Script phase uses my specific Ruby because it's being run from within my shell environment (even if the Shell path in the project file is set to /usr/bin/ruby, it still uses my 1.9.3).

What can I do to make the IDE use my 1.9.3 Ruby install?

share|improve this question
Wouldn't creating a symbolic link do the trick? For instance: ln -s $HOME/.rvm/bin/rvm-auto-ruby /usr/bin/ruby –  fmendez Mar 18 '13 at 11:39
I suppose it could, but I want to leave the default installation intact if possible - and I'd like a solution that would work on another machine without having to mess with its default install as well (installing RVM would be required obviously, but if I can leave the /usr/bin install alone that's ideal) –  Jasarien Mar 18 '13 at 11:46
add comment

1 Answer

Try this at the beginning of your script in Xcode:

source "$HOME/.rvm/scripts/rvm"
share|improve this answer
add comment

Your Answer


