I’d like to run a ruby script automatically once or twice a day on my MacBook running OS X Yosemite.
Problem is that I currently have three versions of Ruby on my system including 1.8.7 and 2.2.1, neither of which the script will run with. So I say
rvm use system which switches to a different version, though I don’t know how to find out which one (as
rvm current just replies “system”). And then I can run the script happily.
However, when I create this little script:
#!/bin/bash rvm use system /Users/jonathan/Library/Scripts/slogger/slogger
It won’t run from the shell, saying:
RVM is not a function, selecting rubies with 'rvm use ...' will not work. You need to change your terminal emulator preferences to allow login shell. Sometimes it is required to use
/bin/bash --loginas the command.
I know how to create and set basic launchd jobs; but I don’t know how to set the ruby version for the created process if I can’t include it in a script in this way. I’m sure it must be possible, though…