Macs are like any other computer. sometimes they will not startand sometimes they are not closed. If your Mac refuses to shut down, here's how to shut it down anyway and hopefully solve the problem permanently.
How to shut down your Mac
To turn off your Mac, just click on the Apple logo in the menu bar at the top of your screen, then choose "Stop …" and "Stop" in the box that appears. If you're particularly impatient, you can hold down the Option button on your keyboard while clicking the menu option to prevent this confirmation box from appearing.
Once you have started the shutdown process, you must wait. Even if you do not check the "Reopen windows when connecting" checkbox, you will still have to wait for applications and windows to open before your Mac turns off.
If your Mac does not turn off, it's time to try a few more things.
The software can cause problems stopping
Sometimes software can prevent your Mac from shutting down properly. Sometimes your Mac informs you that "Application blocked is stopped" and that sometimes you do not see any errors. Start by closing all your applications by right-clicking (or clicking with two fingers) on their icons in the dock and choosing "Exit".
You can force the closing of applications that do not respond or close. Right-click the application icon, hold down the Options key on your keyboard, then click "Force Quit" and the application should close. You can then try to stop again.
If that does not work, it is possible that a background process has got stuck and is causing the problem. Open the Activity Monitor (press Command + Space and then find it) and click the CPU tab. You can order the "% CPU" column in descending order to see if any applications are using a large amount of CPU power. If they are, click on them to highlight them, then click on the "X" at the top left to end the process.
Other applications that may have failed will be highlighted in red, followed by a label indicating "(not responding)". You will have to click on it and then click on the "X" to kill them too. Assuming you get rid of all the errant processes, it's time to try to stop again.
Unplug all devices
Devices can also cause problems when you try to shut down your Mac. For best results, disconnect all connected devices and try again. If you use an iMac, you can try to unplug everything except your mouse or Magic Trackpad (although keyboards should not cause any problems).
Safely remove external drives by right-clicking them and choosing "Eject". [DISK]"Or by clicking and dragging the volume into the trash. If you can not eject, you may have found the problem. You may see a new window popping up with the choice to "force the eject …" that you can try.
Otherwise, you can force the eject via the terminal with the following command (replace "DISK" with the name of your drive):
diskutil unmountDisk force / Volumes / DISK
For a list of attached drives, run this command first:
disk utility list
When everything fails: force your Mac to restart
If your Mac still does not stop, you just have to "pull the plug" and force the shutdown. It works on both desktop and MacBooks. To do this, first hold down the control and command keys, then press and hold the Mac power button.
If you do not have a power button, you will need to hold down the Control and Command keys and the Eject button or the Touch ID button instead. Hold down the button for about 10 seconds, after which the screen of your Mac will turn black. Wait about 30 seconds before restarting your machine.
Note: This should only be used as a last resort. The shutdown process is set up to protect critical system files that must always be closed properly before powering down the machine. Your Mac will probably work fine after a forced reboot, but there is always a risk. If something goes wrong and your Mac does not start anymore, find out how to fix a Mac that does not start.
A reboot will solve the vast majority of problems that prevent your Mac from shutting down properly. If this problem becomes more common, you will have to go to the source of the problem as follows.
Prevent stop problems in the future
If the problem is caused by software, you can take some steps to correct it. If an application interrupts your shutdown, try check for software updates this can solve the problem. You may want to give up the application for an alternative if such an option exists. Try restarting your Mac without first running the problematic software.
macOS should also be updated regularly to keep up with the issues. You can search for software updates under System Preferences> Software Update. When you are there, you can enable automatic updates by clicking "Advanced …" and then checking the appropriate boxes.
Start in safe mode
Restarting your Mac in Safe Mode can also help prevent the problem from reoccurring in the future. When you start your Mac in safe mode, the startup disk is scanned for problems and macOS will try to fix the detected problems. Safe mode also removes font, kernel, and system caches, as well as a few other items.
To start your Mac in safe mode:
Turn off your Mac (you may have to force the shutdown).
Press the power button and then immediately hold down the Shift key (one or the other).
Release the Shift key when you see the login window and log in as usual.
When you restart your computer, it restarts in normal mode. Safe mode is not the only alternative boot mode for your Mac. Check out the complete list of macOS boot modes and their uses.
Reset your SMC and PRAM / NVRAM
The System Management Controller (SMC) is responsible for the low-level functions on your Mac, including power management, battery charging, and keyboard backlighting. Sometimes the SMC can cause feeding problems. It is therefore logical to try to reset it if you have chronic closure issues.
The process is simple but differs depending on whether you own a MacBook with an internal battery, a MacBook with a removable battery or a desktop computer such as an iMac. Find how to reset the SMC on your particular Mac.
Nonvolatile RAM (NVRAM) or Parameter RAM (PRAM) is used by your Mac to store settings such as startup disk preferences, display resolution, and time zone information. It is unlikely that NVRAM / PRAM will affect the shutdown of your Mac, but if you still have problems at this point, it is probably worth it.
The process of resetting this memory is the same:
Make sure your Mac is off.
Press the power button (or the Touch ID button on some MacBooks), then release the Option + Command + P + R keys on your keyboard immediately.
After about 20 seconds you can release these keys and your Mac should start normally.
After resetting the NVRAM / PRAM, you may need to adjust settings such as display resolution, startup disk, and time zone. Now, try restarting or shutting down your Mac normally to see if you still have problems.
Still have problems? Try the nuclear option
When all else fails, you can still format your drive and reinstall macOS. You should first back up your Mac with Time Machine to back up your files. Avoid using third-party disk cloning software for backup (we are after a new installation).
You can then follow the instructions for remove macOS and reinstall the operating system from scratch. Do not forget that you will need to restore your Time Machine backup and reinstall the desired software once you have done it. It's not a quick process, so plan an hour or two before you start.
A new installation should clear up the problem for good. It can also solve other problems caused by unused kernel extensions and partially uninstalled software. You may notice that your Mac is faster and you will have a lot of free space.