Can't get launchd task to run 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:

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
    &lt;key&gt;Label&lt;/key&gt;
    &lt;string&gt;com.jwhite.forecast_tmux&lt;/string&gt;
    &lt;key&gt;ProgramArguments&lt;/key&gt;
    &lt;array&gt;
        &lt;string&gt;/Users/jwhite/forecast.rb&lt;/string&gt;
    &lt;/array&gt;
    &lt;key&gt;StartInterval&lt;/key&gt;
    &lt;integer&gt;300&lt;/integer&gt;
&lt;/dict&gt;
&lt;/plist&gt;


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 `&lt;main&gt;'


But when I run this from the terminal everything executes fine. So launchctl can't read in Ruby Gems?
I had the same issue, trying to run a script on an interval using LaunchControl (great app, check it out). Will copy and paste straight from the source that helped me:


  For GUI programs the default shell environment scripts are ignored, and therefore
  RVM managed ruby versions.
  
  The workaround is to define them via launchctl. Those values are gone
  though after a reboot, so I put them in .bash_profile since I open a shell anyhow all the time, see below.
  
  launchctl setenv GEM_HOME ~/.rvm/gems/ruby-2.2.1
  launchctl setenv GEM_PATH ~/.rvm/gems/ruby-2.2.1:/Users/markus/.rvm/gems/ruby-2.2.1@global
  
  All more permanent solutions (e.g. launchd.conf) don't work anymore in 10.10.
  Hope that helps anyone who ran into a similar issue.


In my case I just set it up the correct GEM_HOME and PATH in LaunchControl.