3

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.

  • If you want a terminal command, I recommend crontab. – User9125 Apr 11 '18 at 15:11
  • 2
    @User9125 Can you add an answer below explaining how crontab can be used to open a website for all users on login? – nohillside Apr 11 '18 at 15:20
4

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

  • 1
    I believe he asked for a terminal command. – User9125 Apr 11 '18 at 15:12
  • Very cool idea. Would have coded an Apple Script to do this. Did not know you could add webloc files as login items. – JBis Apr 11 '18 at 23:07
4

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

  • thanks! I'll ttest this out. This will open for all new users signing into the system? – torincsuf Apr 12 '18 at 15:59
  • 1
    You would have to repeat on each account. – JBis Apr 12 '18 at 16:10
  • Looking for a terminal command to add it to every new user. I'm operating a open lab that deletes profiles and new users come all the time. – torincsuf Apr 12 '18 at 17:12
  • Will edit answer soon. – JBis Apr 12 '18 at 18:42
  • I'm guessing there's no way? – torincsuf Apr 26 '18 at 20:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .