Macs are like any other computer. Sometimes they are not started and sometimes they are not shut down. If your Mac does not turn off, you can resolve the issue as follows:
How to shut down your Mac
Shutting down your Mac is as easy as clicking the Apple logo in the menu bar at the top of the screen, and then choose "Shut down …", followed by "Shut Down" in the displayed box. If you are feeling particularly impatient, you can hold down the Option key on your keyboard while clicking the menu option to prevent the confirmation box from appearing at all.
You need to wait. Even if you leave the Reopen window on re-login check box checked, you'll need to wait for your currently open applications and windows to close before shutting down your Mac.
Suppose your Mac does not shut down It's time to try a few more things.
Software can cause shutdown problems.
Sometimes, software can prevent your Mac from shutting down properly. Occasionally, your Mac informs you that "Program was blocked, shut down," and sometimes no errors are displayed at all. First, try closing all applications by right-clicking (or using two fingers) the icons in the dock and choosing Quit.
You can force the termination of applications that do not respond or close. Right-click (or use two fingers) on the app icon, hold down the Option key on your keyboard, and click Force End. The app should then be closed. You can then try again to shut down the system.
If this does not work, it is possible that a background process has crashed and caused the problem. Open the Activity Monitor (press Command + Space and search for it) and click the CPU tab. You can sort the% CPU column in descending order to see if apps consume a lot of CPU power. If this is the case, click on it to highlight it and then click on the "X" in the top left corner to cancel.
Other applications that may have crashed are highlighted in red, followed by a caption labeled "(No Answer). "You have to click on them and then click on the" X "to kill them as well. Assuming you've eliminated bad processes, it's time to try shutting down again.
Peripherals can also cause problems when you try to shut down your Mac. For best results, disconnect all attached peripherals and try again. If you are using an iMac, you can try to disconnect all but your mouse or your Magic Trackpad (however, keyboards should not cause any problems).
Safely remove external drives by right-clicking on them and selecting "Eject [DISK]" "Or by clicking on the volume and dragging it to the trash. If you do not receive a drive to eject, you may have found your problem. You may see a new window with the Force Eject … option you can try.
Otherwise, you can force eject over Terminal with the following command (replace "DISK" with the drive that you have named drive):
diskutil unmountDisk force / Volumes / DISK
To get a list of attached drives, first run this command:
diskutil list  If all else fails: force reboot
If your Mac still does not shut down, you just have to unplug the power and force shutdown. This works on both desktop Macs and MacBooks. To do this, first hold down the Control and Command keys and then the Mac's power button.
If you do not have an on / off switch, you must hold down the control and command keys and the eject button or the key. Touch the ID key instead. Hold down the button for about 10 seconds. After that, the screen of your Mac should turn black. Wait about 30 seconds before restarting the computer.
Note: This should only be used as a last resort. Shutdown is performed to protect the most important system files, which should always be closed properly before turning off the computer. Your Mac will probably work fine after a forced reboot, but this always carries a risk. If an error has occurred and your Mac does not start, find out how to repair a Mac that can not be started.
Reboot resolves most issues that prevent your Mac from shutting down gracefully. If this problem occurs more frequently, you must determine the cause of the problem by following these steps:
Preventing Shutdown Problems in the Future
If the problem is software-related, you can take some steps toward correcting it. When an app stops shutting down, look for software updates that can fix the problem. You may want to give up the app in favor of an alternative, if such an option exists. Reboot your Mac without running the problem software first.
Also, macOS needs to be updated regularly to keep track. You can search for software updates in System Preferences> Software Update. While you're there, you can enable automatic updates by clicking on "Advanced ..." and ticking the appropriate boxes.
Booting in Safe Mode
If you restart your Mac in Safe Mode, this may also help to prevent the problem from reoccurring in the future. When you start your Mac in safe mode, the boot disk is checked for problems and macOS tries to fix detected issues. Safe Mode deletes font, kernel, and system caches in addition to some other things.
To start your Mac in safe mode:
- Turn off your Mac (you may need to force shutdown).
- Press the on / off switch and then immediately hold down the shift key (one of them).
- Release the Shift key when you see the logon window and log in as usual.
When you restart your computer, the computer restarts Normal mode. Safe Mode is not the only alternate startup mode for your Mac. Read the full list of MacOS startup modes and their uses.
Reset SMC and PRAM / NVRAM.
The System Management Controller (SMC) is responsible for low-level features on your Mac, including power management, battery charging, and keyboard backlighting. Sometimes power problems can be caused by the SMC. Therefore, it makes sense to reset the SMC if there are problems with chronic shutdown.
The process is straightforward, but it depends on whether you have a MacBook with an internal battery. a MacBook with a removable battery or a desktop computer like an iMac. Here's how to reset the SMC on your particular Mac.
Nonvolatile RAM (NVRAM) or Parameter RAM (PRAM) is used by your Mac to save settings such as startup volume, display resolution, and time zone information. It is unlikely that NVRAM / PRAM will affect the shutdown of your Mac. However, if you still have problems at this point, it's probably worth trying.] Make sure your Mac is turned off.
After resetting NVRAM / PRAM, you may need to adjust settings such as screen resolution, boot disk, and time zone. Now, try restoring your Mac normally or shutting down to see if there are any problems.
Are you still having problems? Try the Nuclear Option
If all else fails, you can always format your drive and reinstall macOS. You should first back up your Mac with Time Machine to save your files. Avoid using third-party disk-backup software to backup (after all, we're after a clean install).
You can then follow the instructions for deleting macOS and reinstall the operating system from scratch. Remember, you must restore your Time Machine backup and reinstall the desired software as soon as you have done so. This is not a fast process. Take an hour or two before you start.
A clean install should fix the problem for good. It can also solve other problems caused by leftover kernel extensions and partially uninstalled software. You may find that your Mac is faster and has enough free disk space.