rubyxcodecocoapodsrelease-managementxcodeproj

What is a proper way to execute ruby script from xcode build phase script?


I wrote some ruby script, that uses CocoaPods/Xcodeproj to edit xcode project file.

This script executes from xcode build phase script:

ruby script.rb someProj.xcodeproj

Inside ruby script, there is a 'require' for xcodeproj:

require 'xcodeproj'

When I invoke this script manually from terminal, everything is ok.

But when it invokes from xcode build phase, ruby throws exception:

cannot load such a file xcodeproj (something like that)

What am I missing?


Solution

  • Build phase -> Shell: change /bin/sh to /bin/bash -l Bash login is required, in order to load ruby variables/paths/etc.