How to Remotely Restart or Shut Down Your Mac

Don't Power Off a Sleeping Mac; Use a Remote Restart Instead

Remote Login - Sharing Preference pane
Screen shot courtesy of Coyote Moon, Inc.

It's more efficient to remotely shutdown or restart a Mac than to physically access the device, in situations where the non-cooperating computer is physically distant from you—for example, in a different building of your office or a different floor of your house.

Remotely Accessing a Mac

To use remote access to control your Mac, all of the computers must be Macs and connected on the same local network in your home or business. (You can still use Internet connections, and also Windows- or Linux-based PCs, but the process differs from what we describe, below.)

Two Methods to Remotely Access a Mac

No vendor-supplied app or special hardware device is necessary; you have everything you need already installed and ready to be used on your Macs.

The first method makes use of Mac’s built-in Virtual Network Computing server, which on the Mac is commonly called screen sharing. The second method makes use of Terminal and its support for Secure Shell, a network protocol that supports secure encrypted remote login to a device.

Using Screen Sharing to Remotely Shut Down or Restart a Mac

Although the Mac has native support for screen sharing, this feature is disabled by default. It needs to be enabled using the Sharing preference pane. Turn the Mac’s VNC server on to enable Mac screen sharing. When it's activated, connect to the remote desktop to take control of the Mac. You'll only need to activate it once, on the Mac you intend to remotely access.

After you have made the connection, the Mac you're accessing will display its desktop on the Mac you're sitting at. You can use the remote Mac just as if you were sitting in front of it, including selecting the Shut Down or Restart command from the Apple menu.

Using Remote Login (SSH) to Shut Down or Restart a Mac

The second option for taking control of the Mac is to use the remote login capabilities. Just as with screen sharing, this feature is disabled and must be turned on before you can make use of it.

  1. Launch System Preferences, either by clicking the System Preferences icon in the Dock, or selecting System Preferences from the Apple menu.
  2. In the System Preferences window, select the Sharing preference pane.
  3. In the list of services, place a checkmark in the Remote Login box to enable remote login and display options for who is allowed to connect to the Mac. Limit access to yourself and any administrator-level account you have created on your Mac.
  4. Select the option to Allow access for: Only these users.
  5. You should see your user account listed, as well as the Administrators group. This default list of who is allowed to connect should be enough; if you do wish to add someone else, click on the plus sign at the bottom of the list to add more user accounts.
  6. Before you leave the Sharing preference pane, write down the IP address of the remote Mac. You'll find the IP address in the text shown above the list of users allowed to log in.
  7. To log into this computer remotely, type ssh username@IPaddress. An example would be:
    ssh user@192.168.1.50
  1. The number sequence is the IP address of the Mac in question. Remember, your IP will be different than the example above.
  2. After you log in, to shut down the remote Mac, type
    sudo shutdown -h now
    to immediately shut the computer down, or type
    sudo shutdown -r now
    to immediately reboot it. You may need to input your administrator-level password. Instead of now, you can also type +n, with n representing a number in minutes that will elapse before the command is executed. For example, sudo shutdown -r +5 will reboot the Mac in five minutes.

If you shut down or reboot the Mac from the SSH command line, you may immediately lose your SSH connection. This behavior is expected. You can re-authenticate as soon as the remote machine has rebooted.