How to set up a login hook
Mac OS X 10.3, 10.4, or later
- Open Terminal (Applications/Utilities).
- In the Terminal window, type:
sudo defaults write com.apple.loginwindow LoginHook /path/to/script
- (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.
- Type your password at the prompt, then press Return.