Question

I'm attempting to use launchctl on Mac OS X to run a simple script at login.

When I run launchctl start com.user.loginscript I receive the error "launchctl start error: No such process". Checking launchctl list shows an error code of '1' if I attempt to load and utilize the plist file.

My plist file is as follows...

`

<!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>com.user.loginscript</string>

    <key>Program</key>

    <string>~/Movies/test.sh</string>

    <key>RunAtLoad</key>

    <true/>

</dict>

</plist>

`

Any suggestions as to what might be going wrong?

EDIT: The silly test.sh is as follows... #!/bin/bash say "Hello Myles"

Was it helpful?

Solution

You'll need to use the full path to the script -- ~ is a shell shorthand, and since launchd doesn't pass the program name through a shell, it's actually looking for a folder named "~" rather than your home folder.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top