Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jacobsalmela/cd89d7a60021b258227a to your computer and use it in GitHub Desktop.
Save jacobsalmela/cd89d7a60021b258227a to your computer and use it in GitHub Desktop.
(OS X) Enters a user's credentials into the GUI login window fields and logs them in (access to assistive devices needs to be enabled for osascript to work)
osascript -e <<EOF 'tell application "System Events"
tell process "SecurityAgent"
set value of text field 2 of window "Login" to "username"
set value of text field 1 of window "Login" to "password"
end tell
tell application "system events" to keystroke return
tell application "system events" to keystroke return
end tell'
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment