Lingon, launchd, and updating my macports installation
Here’s the rub: the CLI application for updating MacPorts, “port” likes to have a home environment variable populated. Apparently this happens when executing port from a CLI. When running from launchd, however, $HOME is empty and thus the script dies.
The fix is trivial. You need to add the following to your user daemon (it needs to run as root, so user daemon it is):
EnvironmentVariables
HOME
/var/root
Here is the full context. (the path to your user daemons is at:)
/Library/LaunchDaemons
System-wide daemons provided by the administrator.
EnvironmentVariables
HOME
/var/root
Disabled
KeepAlive
Label
com.ksk.updateMacports
ProgramArguments
/usr/bin/update-port.sh
RunAtLoad
StartInterval
43200