3

I am looking for a way to run an application like Reflector or AirServer on both a Mac and PC before the user login occurs, the application is pretty much GUI-less until someone starts sending data to it, at which point it goes full screen.

Is there a way to run an application in the Login screen on a Mac and/or PC?

1 Answer 1

2

In OS X you can create a pre-login launchd agent. For example save this property list as /Library/LaunchAgents/some.label.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>some.label</string>
  <key>LimitLoadToSessionType</key>
  <array>
    <string>LoginWindow</string>
    <string>Aqua</string>
  </array>
  <key>ProgramArguments</key>
  <array>
    <string>say</string>
    <string>a</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
</dict>
</plist>

Make sure the plist is owned by root. If it is not, it can be loaded if you run launchd load as the user but it is not loaded by launchd automatically.

Then if you restart, the say command should be run once when the login window is shown and again after a user logs in graphically.

If you don't want the program to be run again when a user logs in graphically, remove <string>Aqua</string>.

If automatic login is enabled and LimitLoadToSessionType is set to just LoginWindow, the program is not run at all.

See the Daemons and Agents tech note or man launchd.plist for more information.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .