launchctl - use rvm instead of system Ruby in executed scripts?

Posted by Stefan Kendall on Super User See other posts from Super User or by Stefan Kendall
Published on 2012-06-12T14:53:42Z Indexed on 2012/06/12 16:42 UTC
Read the original article Hit count: 252

Filed under:
|
|
|
|

I have a launchctl job I define as such:

<key>ProgramArguments</key>
    <array>
        <string>/bin/sh</string>
        <string>-c</string>
        <string>~/projects/script.sh</string>
    </array>

When I run script.sh manually, the script works fine, as it uses the currently configured rvm version of ruby. When I run this through launchctl, the system version of Ruby is used, which breaks the script. How can I get this script to run with the right version of ruby available?

© Super User or respective owner

Related posts about bash

Related posts about ruby