I've done this once and I'm trying to do it on a new computer and I can't see what I'm doing wrong.
I have a ruby script in my user folder named forecast.rb. I have set it to executable (a+x). It writes a line out to another file called .weather.txt.
I want to run forecast.rb every 5 minutes.
I have a plist file named com.jwhite.forecast_tmux.plist. That file looks like:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.jwhite.forecast_tmux</string>
<key>ProgramArguments</key>
<array>
<string>/Users/jwhite/forecast.rb</string>
</array>
<key>StartInterval</key>
<integer>300</integer>
</dict>
</plist>
This file is located in ~/Library/LaunchAgents. And after moving it there I ran Launchctl load -w ~/Library/Launchagents/com.jwhite.forecast_tmux.plist.
If I run forecast.rb (./forecast.rb) it runs fine. But my launchd is not executing.
What am I missing?
EDIT:
I've started using LaunchControl and got the error.
/Users/jwhite/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- geocoder (LoadError)
from /Users/jwhite/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/jwhite/forecast.rb:3:in `<main>'
But when I run this from the terminal everything executes fine. So launchctl can't read in Ruby Gems?
#!/Users/jwhite/.rvm/rubies/ruby-2.2.1/bin/ruby