Run bash script at login stored in the home folder? When I try to load a LaunchAgent plist from launchctl I can't find out how to run a script in the home directory.

My code is:

&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;ProgramArguments&lt;/key&gt;
    &lt;array&gt;
        &lt;string&gt;bash&lt;/string&gt;
        &lt;string&gt;~/script.sh&lt;/string&gt;
    &lt;/array&gt;
    &lt;key&gt;RunAtLoad&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;Label&lt;/key&gt;
    &lt;string&gt;com.tyilo.test&lt;/string&gt;
&lt;/dict&gt;
&lt;/plist&gt;


I have tried both with and without bash and also replacing ~ with $HOME.
I have also tried using bash -c without it working.

The error code is: 

`com.tyilo.test: bash: ~/script.sh: No such file or directory`
EnableGlobbing doesn't work on OS X Yosemite 10.10. It has been deprecated (ref).

You can see in logs The EnableGlobbing key is no longer respected. Please remove it. (from /var/log/system.log)

The problem is that launchd cwd (current working directory) is /, so you can't use ./ like some people said.

To run a script from your home the simple way is to use (bash|zsh|sh) -c. option. This way you will have the ability to use the tilde ~ or the $HOME variable.

&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;org.your.stuff&lt;/string&gt;
    &lt;key&gt;ProgramArguments&lt;/key&gt;
    &lt;array&gt;
      &lt;!-- here is the important thing --&gt;
      &lt;string&gt;zsh&lt;/string&gt;
      &lt;string&gt;-c&lt;/string&gt;
      &lt;string&gt;~/you/script/in/your/home&lt;/string&gt;
    &lt;/array&gt;

    &lt;!-- code below is just for the example --&gt;
    &lt;!-- Keep running... --&gt;
    &lt;key&gt;KeepAlive&lt;/key&gt;
    &lt;true /&gt;
    &lt;!-- ...every day. In sec, 60*60*24 = every day --&gt;
    &lt;key&gt;ThrottleInterval&lt;/key&gt;
    &lt;integer&gt;86400&lt;/integer&gt;
  &lt;/dict&gt;
&lt;/plist&gt;