Shutdown Terminal Mac

Make sure remote login is enabled on the Mac (this applies to shutting down Linux systems too), then use ssh: codessh [email protected] sudo shutdown -h now /codeWhere user is the user name of a user with administrator privileges, and host is the.

Mac or MacBook stuck when shutting down or restarting? How to fix?

  • The ‘Kill’ Command in Terminal. If you prefer a command line method for dealing with unresponsive apps, you can use the ‘kill’ command in Terminal. To use this method, you’ll need to determine the app’s Process ID (PID), a numeric value that OS X uses to keep track of each unique application.
  • Standard Shutdown. This is the most common way to shut down your computer and is used.
  • Oct 28, 2014 Another approach you can use for restarting your Mac is to use the Terminal, where there are several commands available performing these actions: sudo shutdown -r now This command will perform a restart on your Mac immediately.

Where Is Terminal Mac

You might finish work on your Mac, attempt to shut it down, only to find that it is stuck on a desktop picture without any icons. Or perhaps the MacBook freezes on a black screen, but you can still hear sounds from the device (HDD, etc.) Furthermore, you might attempt to unplug the power adapter and remove the battery, but still notice that the computer has not completely shut down. If you encounter these issues when attempting to restart or shut down a Mac computer, this article may be useful.

Unfortunately, many people encounter these problems, which commonly arise following an operating system update. Windows users who have recently switched to a Mac computer will probably not be too surprised, since this is a common issue on Windows platforms. Fortunately, Macs have built-in tools to solve these problems. The first step when troubleshooting these issues is to force the Mac to shut down and reset System Management Controller (SMC) and Non-Volatile Random-Access Memory (NVRAM). Follow this guide to resolve Mac restart and shut down issues.

Table of Contents:

It is recommended to run a free scan with Combo Cleaner - a tool to detect malware and fix computer errors. You will need to purchase the full version to remove infections and eliminate computer errors. Free trial available.

What is SMC and what is its function?

System Management Controller (SMC) is a low-level Mac hardware component that controls computer power consumption, battery charging and functionality, thermal and fan activity, GPU and video mode functionality/video output, sleep/wake modes and led lightning management, and other hardware functionality. Resetting the SMC might solve issues related to these devices.

Reset SMC of a MacBook Air, MacBook Pro Retina, or MacBook Pro with an integrated battery

Shutdown terminal mac commandShutdown Terminal Mac
  • First, shut down the device and connect the power adapter to the Mac.
  • Hold down the Shift, Control and Option keys while clicking the power button.
  • Finally, release all keys simultaneously - the light on the MagSafe adapter might change color to signify that SMC has been reset.
  • After a successful reset, reboot the computer in the usual way.

To reset SMC on a non-portable device, follow these instructions:

  • Shut down the Mac.
  • Disconnect the power cord.
  • Hold down the Mac power button for five seconds.
  • Release the button, reattach the power cable, and boot the Mac in the usual way.

For more information and detailed instructions read this guide.

Reset NVRAM

NVRAM (non-volatile random-access memory) is small area of Mac memory that stores certain settings in a location accessible by the macOS. The memory area stores information such as speaker volume, screen resolution, startup disk selection, and any recent kernel panic reports. To reset the NVRAM, shutdown the Mac. Turn it on, and after the loading chime, hold down the Option, Command, P and R buttons together. Keep holding this combination for at least 20 seconds. The display should appear as if the computer is restarting. If you hear the start up chime again, release the buttons.

What is a kernel panic?

Sometimes shutdown problems are caused by recent 'kernel panic' events - resetting the NVRAM should solve these issues. Kernel panics often result in various system crashes involving restarts and shutdowns. A kernel panic is essentially a system error when the Mac operating system is unable to quickly or easily recover. These errors are commonly the result of actions when the Mac attempts to write or access memory incorrectly. They are often caused by corrupted software, software bugs, or malware. Sometimes, they are caused by damaged or incompatible hardware, including faulty external devices connected to the Mac.

Launch Apple Diagnostics or Apple Hardware Test

Apple Diagnostics and Apple Hardware Test are built-in tools that can help to diagnose problems related to the Mac's internal hardware, including parts such as system memory, logic board, and wireless components. Furthermore, these tools are accessible even if the MacBook (or other Apple computer) is unable to boot properly. Follow the steps below to run the diagnostic tool.

Before you start troubleshooting, bear in mind that none of these tools are able to inspect external components, such as external storage or devices, not manufactured by Apple. Also, these particular tools examine hardware only and do not check operating system status.

  • For Macs released after 2013, owners should look for Apple Diagnostics, which is included in their computers.
  • For computers released in 2012 or earlier and running OX X version 10.8.4 or later, use Apple Hardware Test, which is also included with the system.
  • If you have a Mac that was released in 2012 or earlier and running OS X version 10.8.3 or earlier, use the system software disc or USB flash drive that came with the Mac.

How to run Apple Diagnostics

Disconnect all external devices except the keyboard, mouse or trackpad and display. When all unnecessary components are disconnected, restart the Mac, and then press and hold down the D key while the computer restarts. Apple Diagnostics launches automatically - follow the on-screen instructions to proceed and a list with the problem detected will be displayed.

How to run Apple Hardware Test

Unplug all external components except the keyboard, mouse or trackpad and display. When all external devices are disconnected, restart the Mac, press and hold down the D key while the computers restarts. When Apple Hardware Test launches, a window with a list of languages will appear. Choose your preferred language and press Return or click the right arrow. If Apple Hardware Test did not launched, try to run it from the Internet. Reconnect the Apple computer to the network through Wireless or Ethernet and then restart. After the start up chime plays, hold down the Option and D keys. When Apple Hardware Test prompts, select your preferred language and follow the on-screen instructions. If the tool detects problems, they will be displayed on screen. Take a note of these details for contacting Apple Support or a certified service provider.

Try booting in a Safe Mode

A Safe Boot deletes system caches, rebuilds the Mac boot database on the hard drive - this frequently solves various issues. Furthermore, Safe Mode is probably the best way to check if the issue is global or limited to a particular user folder. Shut down and restart issues might be related to third-party software that is loading automatically. Safe Mode checks the system for errors and attempts to solve detected errors.

To enter Safe Mode, first shut down the Mac using whichever method works in your situation. When the computer has completely shut down, wait for approximately 10 seconds and press the power button again. When you hear the start up chime, immediately press and hold the Shift key, and release it when you see the Apple logo and progress indicator.

Bear in mind that safe boot takes much longer than usual, since the computer loads and also performs a system check. If the Mac works correctly, click the Apple logo and select restart.

Use terminal to clear your Mac

Experienced users often use Terminal to solve various issues - in this case, it also contains various options to try. First, open Terminal by using spotlight - hold command and press the spacebar, and type Terminal. Alternatively, go to the utilities folder through finder. Once Terminal has launched, type the following commands one-by-one and press Return after each command.

  • rm -rf ~/Library/Caches/*
  • rm -rf ~/Library/Saved Application State/*
  • sudo rm -rf /Library/Caches/*
  • sudo rm -rf /System/Library/Caches/*
  • atsutil databases -removeUser
  • sudo atsutil databases -remove
  • sudo atsutil server -shutdown
  • sudo atsutil server -ping
  • sudo rm -rf /var/folders/*

When you have tried all commands, restart the Mac.

Alternative methods to solve your shut down and restarting issues:

  • We recommend Combo Cleaner to clean Mac cache files and malware.
  • Remove all printers by going to System Preferences and selecting Printers & Scanners, and then add the required devices again.
  • Before shut down or restart, force quit any running apps by pressing Command, Option and Esc together.
  • Relaunch Finder before shut down from the force quit menu.
  • Ensure, the Trash is empty.
  • Try to shut down the mac via Terminal, type sudo shutdown -r now and press Return.
  • Enter Recovery Mode by holding Command and R while booting, go to disk Utility and run Repair disk, or First Aid to the hard drive.

Video Showing how to solve issue Mac stuck while shutting down or restarting:

I spend most of the time on my Mac working from the terminal.And while there are several other ways to shutdown, restart or put the computer to sleep, I alwayschoose to do so using the command line.

This is also useful for remote machine administration if you’re using SSH or mosh.

I know the topic seems pretty basic, and it is, but I was surprised to find out many colleagues ofmine don’t use this method and thought it may be helpful for others.

Usage

To perform all three operations you can use the shutdown command, which “Close down the system at a given time”.

Shutdown

Restart

Sleep

Shutdown Terminal Mac

  • The command has to be run as root, so unless you’re logged in you’ll need to prefix it with sudo

  • In case you want to delay the operation in X minutes, just specify the number after the -h flag

    Will shutdown the Mac in 60 minutes.

Pro Tip

I use these aliases in my .zshrc