Open Browser on Login

How would I configure mac's to open a browser to a certain website on login for all users? I work in a lab we need to distribute a survey.

I'm looking for a possible terminal command to configure this.


To configure an action like Open Browser on Login follow these steps:

  1. Go to System Preferences->Accounts and select your user account in the left column
  2. Then Select the Login Items tab on the right. There you see a list of applications and files that you can direct your Mac to open at login)
  3. Just drag your .webloc file(s) into the Login Items list

And the next time you log in, Your Mac will open automatically the web location (.webloc) you put in Login Items tab (with your default browser)

Start Items

Here more detailed explanation about how add .webloc files on login startup: https://www.macworld.com/article/1156341/open_websites_login_startup.html


Simple.

defaults write loginwindow AutoLaunchedApplicationDictionary -array-add '{ "Name" = "Website" ; "Path" = "/path/to/file.webloc"; "Hide" = 0; }'

This command will do exactly what @jasubal's answers does, except its less user friendly and, as requested, is a terminal command.

UPDATE: Here is a single command to apply to all users. Note: This is untested but should work. From here.

sudo defaults write /Library/Preferences/loginwindow AutoLaunchedApplicationDictionary -array-add '{ "Path" = "/path/to/file.webloc"; "Hide" = "0"; }'

The above command adds a Global Login Item.

To remove all Global Login Items you can use the following command:

sudo defaults delete /Library/Preferences/loginwindow AutoLaunchedApplicationDictionary.

Important: Restart after using these commands for them to take effect