I want to run a shell script at startup. So I have used launchd
.
Everything works fine if the path to the script is absolute like /Users/mac/shell.sh
. But it gives error code 127
when I provide the path like $HOME/shell.sh
or ~/shell.sh
.
I have tried using EnableGlobbing
key and -c
as mentioned in this post. But still im getting error code 127
in /var/log/System.log
.
My plist:
<?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>mac.scriptd</string>
<key>KeepAlive</key>
<true/>
<key>EnableGlobbing</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>/bin/sh</string>
<string>~/shell.sh</string>
</array>
</dict>
</plist>