How shutdown works is by sending a sigterm to all processes which should then deal with that e.
The signals are not sent via the normal key message queue so Apps have to deal with this separately to the code that gets called from quit on the menu. A good app should call common code from both. This other answer shows how to shutdown as if you hit the menu options. But note that apps can cancel this shutdown.
All System Events commands above send Apple events to the loginwindow process. If you do feel like putting a delay on the shutdown, you can use the following command syntax instead:. Sign up to join this community. The best answers are voted up and rise to the top. Home Questions Tags Users Unanswered. Ask Question. Asked 5 years, 10 months ago.
A built-in power schedule
Active 2 months ago. Viewed k times. I would therefore like to know: How to shut down, restart and sleep my Mac using the Terminal command exclusively? Simon Simon 3, 20 20 gold badges 51 51 silver badges 79 79 bronze badges. The command takes a parameter -h, -r or -s to shut down, restart or sleep the Mac. The command has to be run as root so you need to use sudo. Mark Mark I have it aliased in a file that is sourced in my.
Does it really "tell all apps to close files etc. I thought it just killed everything? Useful if things have hung, but if the system is working well, it seems like telling the loginwindow process to do the deed would be more "polite". I am pretty sure that the Unix "shutdown" does not do all the stuff that the regular Mac GUI shutdown process does, thus, to the extent that Apple does not use it in their own software directly but at a minimum does some stuff before invoking it, there is some downside to invoking it directly.
I believe that the "loginwindow" app is available even when not at the GUI login window, and can be invoked via the command line "osascript" tool. It isn't infallible however, so one might need to invoke "shutdown" anyhow or send individual kills to specific processes I suppose. The signal mechanism does not put a message on the Apps message queue as a normal close does but apps still should deal with it.
Today I got a cause: 1 also…. But only on Mojave Reply. Do you have any idea what the problem is?
I also have the code of But it says here in my mbp 15 This does not indicate an issue with your system. Check the power button if you did not perform a hard shutdown yourself. It could be the case that the power button stuck down and forced a shutdown.
Mac keyboard shortcuts
On a laptop, the Mac should hibernate before the battery becomes so discharged it is unable to shutdown correctly, therefore if you see this shutdown cause on a laptop it may indicate a hardware issue with the battery or with the battery controller for reading the charge. Hold D on boot to run Apple Diagnostics and follow the instructions if any errors are found.
If the issue persists, make an appointment at an Apple Store. Back up your data, erase the disk and reinstall macOS. If you continue to run the system, data loss may ensue. Use Time Machine to keep a backup until you are able to erase and restore. A common symptom is being unable to repair with Disk Utility — as such, erasing the disk is required as mentioned. Troubleshoot for stuck application, startup item and any loading preferences. If the problem does not occur, try a new user account.
The system will automatically restart after this shutdown cause, unlike Troubleshooting applies the same for cause Hardware acceleration has been experimentally deemed a potential cause, based on kernel extensions being shown in logs. While it is a bug with macOS that Google Chrome should be able to cause a , such mitigations might be necessary. Potentially linked to operating system issue. Try reinstalling macOS as fresh or booting from clean install on an external drive.
Handy Keyboard Shortcuts To Shut Down Mac Or Make Mac Sleep [OS X Tips]
If possible, swap memory module and check with known-good one to confirm issue is with memory. Check fans physically and with an app such as iStat Menus to determine whether the fans are rotating correctly and being reported correctly. Check air flow: open device and clean airways. Swap battery and check with known-good one to confirm issue is with customer battery.
Make sure the adapter in use is an official Apple power supply. Make sure the adapter is an official Apple power supply. Check AC adapter plug and cable. Confirm current at the wall where the adapter is connected to. Check battery statistics: check if cycles are excessive and may indicate the battery needs replacing. Check the battery connection to logic board. Check thermal contact with heatsink, fans.
Check fans and air flow. Confirm power supply is official Apple. If MagSafe, remove any MagSafe adapters in use e.
MagSafe 1 to 2.