LoginHooks in Mac OS X

How to set up a login hook

Mac OS X 10.3, 10.4, or later

  1. Open Terminal (Applications/Utilities).
  2. In the Terminal window, type:
    sudo defaults write com.apple.loginwindow LoginHook /path/to/script
  3. (where/path/to/scriptis the full path to the script that you want to execute when a user logs in—it doesn’t have to be in the user’s Home directory).

    This modifies the /var/root/Library/Preferences/com.apple.loginwindow file.

  4. Type your password at the prompt, then press Return.