Header Ads


How to Shutdown a Mac from Terminal

How to Shutdown a Mac from Terminal


Advanced Mac users may wish to shut down a computer from the command line. This can be helpful for remote administration , in situations where a Mac is booted into Single User Mode, or many other circumstances of troubleshooting and systems administration. There are several ways to shut down a Mac from the command line, well cover two of the most simple methods using easy syntax.

The Mac Terminal offers many commands for handling various tasks and system functions, and so naturally the command line also offers a method to shutdown a Mac computer from the Terminal as well. An important word of warning: shutting down a Mac through the command line happens instantaneously. There is no confirmation, no warning dialog, no stopping to save documents, no asking to close apps or save anything.

Instead, the Mac will instantly terminate any and all activity going on and immediately shut down the computer. This could lead to data loss, so be sure you are ready to turn off a Mac if you issue these commands.

Apt for the name, the shutdown command can shutdown a Mac as well as . To turn off a Mac with the shutdown command, you will use the -h flag and give the time for now making the syntax like so: As soon as you hit return and authenticate the command, the Mac halts and kills all applications and processes and shuts the computer down.

There is no warning and no dialog, it happens instantly. Unless youre actively logged in as the root user (via single user or otherwise), you will need to prefix the shutdown command with sudo to give the command superuser privileges, thus requiring an administrative password. If you feel like trying this yourself (and you have all data saved and nothing important open) do the following: The Mac will immediately shut down. No data is saved and no dialogs are confirmed, the shut down happens instantly.

You can also use the -h flag to set a time or date for shutting down the computer, for example in 30 minutes, but if you want to shut down the Mac instantly you would use the now parameter with the -h flag rather than a number. If you do feel like putting a delay on the shutdown, you can use the following command syntax instead: Replace 30 with any other number of minutes to shut down the Mac in that amount of time. For example if you put 2 instead of 30 then you would shut down the Mac in 2 minutes.

The halt command can also instantly shut down a Mac via the command line. The process and syntax for halt to turn off a Mac is as follows: Whether you use halt or shutdown does not matter really, its mostly preference and what you can remember when necessary. By the way, the shutdown command can also be by using the -r flag instead of the -h flag.

Keep in mind that for most users the command line approach is not going to be better or faster than accessing the Apple menu Shut Down option or , this is really aimed at advanced users who are already at the command line anyway.


No comments

Powered by Blogger.