Macbook

Starting items automatically at Login in Mac

Mac can automatically launch items and restore your work environment when you log in. There are two features in OS X, login items and resume, which exactly does this.

You tell your Mac to open applications, scripts, or documents when you log in to your computer by specifying login items. With the resume feature enabled, your Mac takes a snapshot of open applications and documents before you shut down and then automatically restores everything again when you log in. It’s like waking your Mac up from sleep mode. You can use login items and the resume feature separately or with each other.

Adding Login Items

Users can add just about anything in a login item everything from applications and documents to custom AppleScripts and Automator actions. You can even automatically mount network drives by adding them as login items.

Every user on your Mac can specify his or her unique login items.

Here’s how to add login items for an individual user:

  1. From the Apple menu, select System Preferences.
  2. Select Users & Groups
  3. Login items

  4. From the sidebar, select a user.
  5. Click the Login Items button.
  6. Click the + button to add a login item. You can select applications, documents, AppleScripts, network drives, and Automator actions.

To hide a login item so it doesn’t appear on the screen when it starts, select the Hide checkbox next to the item. To remove a login item, select the item, and then click the – button.

Adding Login Items for all Users.

If every user on your Mac needs to have the same login items, where all users share a Mac, you can set global login items for all users on a particular Mac. To add global login items, open the Terminal application and type the following command as an administrator:

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

Replace /path/to/item with the path to the login item. To hide the login item, change the hide value to 1.

Execute the command again to add another global login item.

To remove all global login items, open the Terminal application and type the following command:

sudo defaults delete /Library/Preferences/loginwindow AutoLaunchedApplicationDictionary

Performing Actions on Sleep or Wake


Login items are perfect for opening files and running scripts when you log in to your Mac, but what about actions that need to be performed every time you put your Mac to sleep or wake it up? For example, you might want to mute the volume when you put the computer to sleep and then reconnect to a network drive or virtual private network (VPN) when you wake it up.

SleepWatcher (/https://www.bernhard-baehr.de/) is an open-source a command-line tool that can automatically execute Unix commands on sleep or wake.

Resuming Applications and Reopening Windows at Login

Do you want to save your work environment configuration when you restart or shut down and then restore it when you log back in? You can do so by turning on the resume feature.
Here’s how to resume applications and reopen windows at login:

  1. From the Apple menu, select System Preferences.
  2. Select General.
  3. General settings

  4. To automatically save changes to documents when you close them, deselect the Ask to keep changes when closing documents checkbox.
  5. To automatically reopen the active windows when you quit and reopen an application, deselect the Close windows when quitting an applicationcheckbox.
  6. Now, if you select restart or shutdown from the apple menu a dialog box will appear.
  7. resume applications

  8. Select the Reopen windows when logging back in the checkbox.
  9. Click the Restart or Shut Down button.

The next time your Mac starts up, all of the applications and windows you had open when you restarted or shut down will automatically open. If you ever want to turn off the resume feature, just deselect the checkboxes.


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *