Can’t launch daemon with launchctl in Yosemite

From man launchctl

Note that per-user configuration files (LaunchAgents) must be owned by root (if they are located in /Library/LaunchAgents) or the user loading them (if they are located in $HOME/Library/LaunchAgents). All system-wide daemons (LaunchDaemons) must be owned by root. Configuration files must disallow group and world writes. These restrictions are in place for security reasons, as allowing writability to a launchd configuration file allows one to specify which executable will be launched.

Fix is

sudo chmod 600 /Library/LaunchDaemons/x.plist
sudo chown root /Library/LaunchDaemons/x.plist

Strangely enough, using sudo was your problem. By using sudo, you were no longer yourself, so you were not the owner of your own file. Remove sudo, repeat the command and it should load just fine. Sorry for the philosophical approach to it all.


Found the solution.

The correct command in this case is

launchctl bootstrap gui/501 ~/Library/LaunchAgents/retrmail.plist

And to unload,

launchctl bootout gui/501 ~/Library/LaunchAgents/retrmail.plist

Don't know why launchctl load requires root though, but load/unload is deprecated anyways.