Why Does Mac Keep Shutting Down and How to Fix It

macbook keeps shutting down

MacBook keeps shutting down? Whether it shuts off at 40% or 100%, there are multiple possibilities for why this happens. Correctly diagnosing the problem can help fix it efficiently – but how do we do that?

In this article, we’ll teach you 3 things: (1) diagnose why your MacBook keeps shutting down, (2) choose and apply the right fix for your flavor of dying MacBook, and (3) recover data that resulted from the shutdowns. Read on!

Why Does Mac Keep Shutting Down Randomly

As we previously mentioned, there are a lot of possible reasons why your MacBook shuts down randomly. Fortunately, there is a way to quickly narrow down the likely culprits using a simple Terminal command:

log show --predicate ’eventMessage contains "Previous shutdown cause"’ --last 24hr

You may see a bunch of numbers or negative numbers on-screen. Those are error codes that give us an idea of the nature of the problem. To help you understand what each error code represents and how to fix them, we created a simple table that explains the most common codes with jump links to the appropriate solution.

If you have important data on your drive, we suggest that you save it somewhere else before attempting repair (ideally, the cloud). And if you lost data due to these errors, go through our recovery section before proceeding. Some of these methods may cause data loss or at least overwriting.
Error CodeDescriptionSolution
3This error code indicates a forced shutdown. Your Mac abruptly and intentionally powered itself off because it became unresponsive or encountered critical errors and needed a reboot to resolve the issue. This may caused by a lot of things, like compatibility issues, configuration errors, or faulty software.Method 1, Method 2, Method 4, Method 7
5This code does not indicate an error or malfunction. Rather, it means that your Mac was intentionally shut down using the power button or the Shut Down command in the Apple menu. If that’s not the case (ex. your Mac is shutting down randomly), your Mac may be physically damaged.We strongly recommend that you send it to a professional data recovery center to avoid further damage and permanent data loss.
7Code 7 indicated a CPU thread error. A CPU thread is a sequence of instructions that manage everything from interface responsiveness and event handling (for ex. user input). It’s possible that there was an error in the execution of a specific thread that caused system instability or errors, leading to a shutdown. Overheating may also cause CPU thread errors.Method 3, Method 4
-3This error code indicates thermal issues. Your Mac may be overheating, and it shuts itself down in order to protect itself. It’s also possible that your system is throwing false alarms.Method 3, Method 1
-64Code -64 indicates kernel panic. Your Mac’s kernel is responsible for managing processes, allocating system resources, and bridging software to hardware. When a kernel panic occurs (due to overheating, file system errors, or software/hardware malfunction), it may have encountered a critical error that it can’t resolve. This results in a system crash.Method 6, Method 7
-74This code means that your battery temperature is too high. Since extreme temperatures can damage your Mac’s components, it shuts itself off to prevent this. However, it’s also possible that your system is throwing false alarms.Method 1, Method 3, Method 5

How to Fix Mac that Keeps Shutting Down

If we attempted to address all the error codes from a Mac that shuts down randomly, you’ll probably get tired of scrolling. Fortunately, the methods we discuss below have worked for common errors (even if they weren’t among those listed in the last section).

Method 1: Reset your SMC Settings

The SMC (System Management Controller) is a component in Mac computers that manages hardware and system functions like power, temperature, battery, keyboard backlighting, and more.

When your SMC malfunctions, any one of these components may be affected – that’s why resetting it to its default state (and so getting rid of any issues) works as a solution for many different errors.

This method doesn’t apply to Macs with Apple Silicon Processors (M1, M2) because the SMC on those devices automatically manages power and system-related functions. If your MacBook shuts down randomly due to SMC settings, it will automatically take the appropriate actions without user input.

To reset the SMC on your Mac:

Step 1. Shut down your Mac and connects the power cable (to a power source and to your Mac).

Step 2. Press and hold the following keys at the same time: Shift + Control + Option + Power Button.

Step 3. Release the keys at the same time. Then, turn on your computer and observe if your Mac shuts down randomly even after resetting your SMC.

Method 2: Reset your PRAM settings

PRAM (Parameter RAM) is a small amount of memory that stores your Mac’s settings and configuration. It handles functions like speaker volume, screen resolution, and many more. It also manages your Mac’s startup settings.

If your PRAM has been experiencing issues, resetting your PRAM to its default settings can clear them.

To reset PRAM on your Mac:

Step 1. Shut down your Mac.

Step 2. Turn on your Mac and immediately press the following keys: Command + Option + P + R.

Step 3.Once your Mac restarts AND you hear the startup sound for the second time, release the keys.

Once your Mac is fully booted, observe if your Mac randomly shuts down even after resetting PRAM.

This is also a good way to fix your Mac if it has the folder with a question mark on-screen, which indicates an issue with startup disk selection (which PRAM is responsible for).

Method 3: Make Sure Your Mac isn’t Overheating

To protect itself, your MacBook shuts down without warning if it begins to overheat. After all, extreme temperatures can severely damage its components.

To avoid overheating your Mac, make sure you use it on an even surface with nothing obstructing the vents. Don’t use it on surfaces that trap heat, such as your bed or a pillow. In hotter environments, use it in front of a fan.

To confirm if this is indeed your Mac’s primary issue, you can check your temperature using a simple command in the Terminal app.

Unfortunately, this tool isn’t available for M1 Macs and newer models. Instead, we recommend a reliable third-party software like TG Pro.

To check your Mac’s temperature using Terminal:

Step 1. Launch the Terminal app (Finder > Applications > Utilities).
Terminal app in Finder

Step 2. Type the following command and hit Return:
sudo powermetrics –samplers smc |grep -i “CPU die temperature”
Terminal app for CPU temperature

Your Mac’s temperature should NOT be over 90℃. If your Mac gets this hot even if you aren’t using it in a humid environment, you aren’t running too many apps, and it has sufficient airflow, try Method 1. If that doesn’t work, you’ll have to bring your Mac to Apple for service.

Method 4: Update Questionable Software or Delete it

If your Mac keeps turning off while you’re using a certain app, that app may be the issue. Check the App Store or the developer’s website for updates. If the issue persists, delete the app and notify the developer. Enduring the issue isn’t worth it – if your Mac keeps shutting down on its own, your system may eventually get corrupted.

macOS may even notify you and recommend this step by itself if it notices that your MacBook Air keeps shutting down while using a specific app.

Method 5: Check your Battery Health

If your Mac suddenly turns off at a certain battery percentage, it’s probably nearing the end of its life. All batteries have a finite number of charge cycles. For old machines, it’s around 300. For newer machines, it’s 1,000+.

Before heading to the Apple store for a replacement, you can check your Mac’s battery health yourself.

To check your battery health on Mac:

Step 1. Open the Apple menu. Then, hold the Option key to make System Information appear in the dropdown menu. Click it.
System Information option in Apple Menu

Step 2. In the left sidebar under Hardware, click Power. On the right, view Battery Information > Health Information.
Mac System Information window

Here, you’ll see the cycle count that we discussed earlier. Then, note its Condition (Normal and Good are preferable) and its Maximum Capacity. In my Mac’s case, a Maximum Capacity of 90% means that I can now only use 90% of my Mac’s original battery capacity.

Method 6: Run Disk Utility

Software issues and disk errors are common reasons why a MacBook randomly shuts off, especially if they affect your system drive. These problems usually lead to data corruption, file system issues, and even hardware malfunctions, which are what cause your Mac’s instability.

Fortunately, Mac has a built-in tool called Disk Utility that has been designed to handle these errors. In case it affects your system disk (which is likely the case if your Mac keeps shutting down by itself), you need to use it in Recovery Mode.

And if your issue escalated and your MacBook gets stuck on the loading screen, you can still access Disk Utility in Recovery Mode and fix it there.

To use Disk Utility in Recovery Mode to fix system errors:

Step 1. Shut down your Mac.

Step 2. On an Intel Mac, boot your computer and hold the Command + R keys until you see the Apple logo or a spinning Globe. If you’re using an M1 Mac, press and hold the power button instead and click Options > Continue.

Step 3. Select Disk Utility from the menu and click Continue.

Step 4. Click Verify Disk. If that option is grayed out or if it reports any errors, click Repair Disk.

Once the repair process is complete, exit Recovery Mode. Boot into macOS and observe if your MacBook Pro keeps shutting down.

Method 7: Update or Reinstall MacOS

When macOS is outdated or corrupted, shutdowns can happen due to incompatibility, system bugs, instability, security vulnerabilities, and/or corrupted system files. Updating it may solve the issue.

To update macOS:

Step 1. Click the Apple menu > System Settings…
System Settings option in the Apple menu

Step 2. Click Software Update or Software Update Available. Mac will begin downloading any available updates. If it finds any, click Update Now (or Install for minor updates) and accept the License Agreement. Wait for the update to complete and keep your Mac plugged in during the process!
macOS update in System Settings

If the shutdowns persist, your only option may be to reinstall macOS. To do so, shut down your Mac. Then, reboot it and immediately do one of the following: (a) hold the power button (Apple Silicon) or (b) hold the Command + R Keys (Intel).

This will boot your Mac into Recovery Mode where you should see the option to Reinstall macOS. Simply follow the wizard to proceed.

How to Recover Data Lost due to Mac Shutting Down

Unfortunately, when your Mac keeps shutting down on its own, data loss is a likely scenario. Maybe your MacBook Pro keeps shutting down while you were working on a presentation when your Mac suddenly died or you had reinstalled macOS and discovered that some files were missing.

The fastest (and safest) way to restore your data is by using data recovery software. As long as it hasn’t been overwritten by new files and your Mac isn’t physically damaged, you have a good chance of getting them back.

For this article, we’ll be using a tool called Disk Drill. It’s really powerful but easy to use for beginners, and it has excellent support for Mac file systems (HFS+, APFS) and file types (400+ file types and counting). Below, we prepared a step-by-step guide you can follow along with.

To recover deleted data on your Mac using Disk Drill:

Step 1. Download and install Disk Drill.

Step 2. Connect a storage device to your Mac, ensuring it has enough space for the data you want to restore (you shouldn’t save recovered data to the same drive you’re recovering). Launch the Disk Drill app (Finder > Applications).
Disk Drill app in the Finder Applications folder

Step 3. Select your system drive (usually labeled “APPLE SSD”) and click Search for lost data.
Disk Drill drive list

Step 4. Once Disk Drill finishes scanning your drive, click Review found items.
Disk Drill Review scan results button

Step 5. Expand the Deleted or lost and/or the Reconstructed tabs to browse files that were deleted or unsaved (due to the shutdowns or reinstalling macOS). You can filter scan results by file type using the sidebar or use the search tool to locate a specific file. You can also preview any file by hovering your mouse pointer beside it and clicking the eye button that appears.
Disk Drill Filter, Search, and Preview tools

Step 6. Mark the boxes beside the files you want to recover. If you want to restore all the files Disk Drill found, mark the box in the column header (beside Name). Then, click Recover.
Disk Drill file selection

Step 7. Choose a save location on the storage device you connected in Step 2. Then, click Next to proceed with recovery.
Disk Drill recovery folder selection

Disk Drill Basic for Mac doesn’t offer free data recovery. However, you can scan and preview all your files for free. It’s very useful for figuring out if any of your files are still recoverable.

Conclusion

So if your Mac keeps shutting down randomly, don’t panic. Often, the actual problem can be tricky to diagnose but easy to fix. And with proper maintenance and taking caution when installing new apps or even macOS updates, you can avoid having this issue again.

However, data loss can be an annoying side effect, so make sure that you regularly back up important files – ideally, to the cloud.

FAQ

To find out why your MacBook Pro is shutting down, use the following command in Terminal:

log show --predicate ’eventMessage contains "Previous shutdown cause"’ --last 24hr

Then, you can look up what the error code means here.

Here are the possible reasons why your MacBook keeps dying at 40-50% (and what to do about it):

  • Battery calibration – Your Mac’s battery calibration might be inaccurate, causing your Mac to shut down even if there’s plenty of juice left. Recalibrate your battery by following the instructions here.
  • Battery health – Batteries are consumable and so degrade over time. It’s possible that your Mac’s battery jumps suddenly from a decent charge (like 30% or 40%) to 0%. You may have to have it replaced by Apple.
  • Software issues – Faulty software or firmware can affect your battery’s behavior (as well as the components managing it). Remove suspicious apps and update macOS. If that doesn’t work, try reinstalling macOS.
  • Lack of power – Your Mac may not have enough power to run a certain app/s or background process/es, as well as the operating system.
If your Mac shuts down randomly only when it’s unplugged, then the problem is likely your battery. Holding the Option key, click on the Apple menu > System Information. Under Hardware > Power > Health Information, you can check the general condition of your battery.
Alejandro Santos
Chief Writer
Alejandro is Macgasm’s Chief Writer and Apple ecosystem enthusiast. He pens the majority of troubleshooting guides and software reviews for this website, tapping into his love for technology and extensive background in technical writing. He started his career by helping… Full Bio