I know you can run applications on startup on a Mac, but can you run an Automator action, a Service, a shell script, or an AppleScript on startup instead?

I also know you can save all of these as an application, but I don't want it opening in the dock.


First of all, login is distinct from startup. This answer assumes you mean login, as you apparently refer to the ability to start programs as configured in System Preferences » Users & Groups.

Run Automator scripts using the command line utility automator and AppleScripts using osascript. Their man pages explain the usage in detail.

You can set a login hook, but it is rather outdated and deprecated in favor of launchd.

You can create launchd jobs by placing XML configuration files in your ~/Library/LaunchAgents directory. This site contains quite a few rather minimal examples, and you can view /System/Library/LaunchAgents for examples of system-provided launchd jobs. You need the RunAtLoad directive for launchd.

You still can save your AppleScripts and Automator scripts as applications, and run them as such. To hide them from the Dock, edit their Contents/Info.plist file and add an LSUIElement directive as described e.g. here. This will hide its Dock icon and menu.

|improve this answer|||||

You could save a property list like this as ~/Library/LaunchAgents/some.label.plist.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN
<plist version="1.0">
        <!-- <string>osascript</string>
        <string>/path/to/example.scpt</string> -->

It has to be loaded first by running launchctl load ~/Library/LaunchAgents/some.label.plist or logging out and back in once.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.