How to run unix script in login screen before user logs in?
Launchd and LoginWindow
You can use launchd to run your script when the Login Window appears. Within your launchd job ticket, include the key pair:
<key>LimitLoadToSessionType</key>
<string>LoginWindow</string>
Save your launchd job ticket, .plist
, file in the folder: /Library/LaunchAgents/
.