Kernel Panic: fix the "Mac keeps restarting" issue
When your Mac keeps restarting or unexpectedly tells you that you have to restart because of a problem, that's a kernel panic.
A kernel panic occurs when your Mac runs into a problem that is so serious it is unable to continue running. When it happens, your Mac displays a dark grey screen with the words "You need to restart your computer.” Hold down the Power button for several seconds or press the Restart button." In this article, we explain why it happens and how to solve it.
Why does my Mac keep restarting?
Let’s say you’re in the middle of an online meeting or editing a document when suddenly your Mac hits you with an error message that reads something like "there's been a problem." Before you can do anything, your Mac shuts down. Once it restarts, you’ll see a message saying that "your computer restarted because of a problem." That’s kernel error also known as kernel panic.
What is a kernel panic? Basically, it’s a failure of the macOS kernel — an important part of the operating system responsible for controlling CPU, memory, and other critical processes. Frequent kernel panics not only disrupt your workflow, they also disrupt your Mac’s health. This is why it’s important to find out what’s causing kernel panic and fix it as soon as possible.
What's causing Kernel Panic? Identify potential problems
It can be a million reasons why your Mac keeps restarting.
When was the last time you updated your operating system? If the answer is you don’t remember, you’d better go to the Apple menu > About This Mac > Software Update. If you see any updates pending, click Update. Apple brings security and performance improvements to every new macOS, so your Mac will definitely work better if you run regular updates.
It’s not only an outdated system that might cause kernel panic, old and incompatible software is another common issue. The best practice is to consistently update macOS as well as every individual app you use. Yes, every app! Outdated apps tend to misbehave on newer macOS, which includes kernel panic. Even more, some of your apps and plugins might stop working after you update macOS.
Update apps manually through their menus, App Store (if you installed them through App Store), or the CleanMyMac X Updater. The latter can automatically generate a full list of outdated software and let you update all apps in one click.
There might be the case that a new app just won’t work with your macOS. Check system requirements every time before you install new software.
Incompatible peripheral devices
One of the ways to quickly diagnose a kernel panic issue is to disconnect all peripherals such as mice and keyboard. If your Mac goes back to normal and stops restarting, you’ve found it. Peripheral devices and accessories can indeed cause kernel panic. The best way to fix it is to find out which one is at fault — simply reconnect peripherals one by one — and replace that peripheral.
External device issues
If you notice kernel panics happen after you’ve connected an external drive, USB, or SSD, there’s probably a problem with that external device. Maybe some directories or file systems are corrupted, or maybe the file system is incompatible with your macOS, etc. The best solution is to run First Aid with Disk Utility, Apple’s native troubleshooting tool:
- Shut down your Mac through the main menu
- Restart in Recovery Mode by pressing and holding Command + R
- Choose Disk Utility at startup
- In Disk Utility, select the external device > First Aid.
First Aid essentially does an attempt to repair the disk. If it fails, you’ll see the message that reads something like “the task reported failure.” If it succeeds, you’ll get “operation successful.” Successful repair means you can restart your Mac, connect the external device, and continue your work without any issues. Otherwise, you might need to replace the external device. But first, make sure you recover data from that device.
Disk issues might sound intimidating because if a disk fails, the files are in danger. The good news is if you have Disk Drill on your computer, you can recover data from any external or internal drive. Here’s how it works:
- Open Disk Drill and select your drive from Storage Devices
- Click “Search for lost data” on the right
- Once Disk Drill completes the scan, click Recover.
Disk Drill is not only good for recovering lost or deleted files, it can also run byte-to-byte backups — which is a great alternative to Apple’s Time Machine. In other words, if you have Disk Drill, you can never be worried about losing your precious files and photos.
Some users report that Apple Diagnostics points them toward RAM issues when they try to figure out why MacBook keeps restarting. This indeed can be the cause. Sometimes, there’s a problem with RAM blocks (especially if you have an older Mac). It can be fixed by replacing RAM modules and we recommend that you book an appointment with Apple’s Genius Bar to get it fixed.
If your Mac runs low on RAM, it will freeze and slow down, with the possibility of shutting down and restarting unexpectedly. Lots of applications we use throughout the day can exhaust memory, including Chrome, Slack, and others. Mac would send you a notification saying you’re running low on RAM a few times, but we all know how easy it is to miss those.
To keep an eye on memory consumption, you can use CleanMyMac X menu bar app — it shows the amount of memory available and notifies you if there are any RAM-heavy apps running. If you want even more detailed insights, get iStat Menus. It shows real-time stats on memory pressure, a breakdown of wired, active, and compressed memory, etc. And not only that, iStat is perfect for monitoring CPU, fans temperature, and network — everything that can impact your Mac’s performance.
Read this guide on how to reduce RAM consumption on Mac.
How to stop a kernel panic?
You can’t really do anything when your computer suddenly restarts. However, you can take measures to prevent the problem in the future. Start by figuring out what’s causing kernel panic and then go through a few steps to optimize your Mac’s performance.
Here’s what to do when your Mac keeps restarting.
Check crash reports
Mac keeps account of all the processes, including kernel panics. In other words, when your Mac suddenly restarts, your Mac takes a note of it and puts the incident into a crash report. These reports are usually not very informative but you can still find some insights in them.
To access crash reports on Mac, go to Applications > Utilities and find Console on the list. Console is a native log viewer usually used to troubleshoot macOS issues. In Console, choose Crash Reports on the left and search through recent reports. They are hard to read but each report contains something like “reason: failed because” or “terminated due to.” That’s what you’re looking for. It probably won’t state the exact cause but you’ll find some clues.
Boot your Mac in safe mode
Over 80% of all kernel panics are caused by some kind of faulty or outdated software. Apple recommends restarting your Mac in safe mode to check if it’s really the case and your Macbook keeps restarting because of the software issue. Safe mode restarts your Mac with only the essential software so you can easily understand if you should look further into your apps or not. If Mac runs well in safe mode, go ahead and update or uninstall non-essential software.
How to boot in safe mode on an M1 Mac:
- Shut down your Mac and wait around 10 seconds
- Restart your Mac by pressing and holding the Power button
- Choose the startup disk from startup options
- Press and hold Shift > Continue in Safe Mode > Release shift.
Here’s how to boot in safe mode on an Intel Mac:
- Shut down your Mac and wait around 10 seconds
- Restart your Mac, then press and hold Shift
- Once you see the login screen, release Shift.
Manage login items
Some applications open immediately after your Mac starts up or after you log in your account. The ones that launch on startup are called launch agents, and those that open at login are login items. Both can put serious pressure on the system, and if there are too many of them — they could cause a kernel panic. Solve this issue by disabling launch and login items.
CleanMyMac X has a dedicated module for managing login items and launch agents — you’ll find it under Speed > Optimization. All you have to do is select all items or specific items on the list and click the Remove button. Note that this action will not delete your apps, it will simply stop them from launching automatically.
There’s also a way to manage your login items manually. It’s a bit more work and it doesn’t help remove launch agents, but it’s the best thing you can do if you don’t have CleanMyMac X installed on your Mac:
- Open System Preferences
- Go to Users & Groups
- Click the lock and type your password to make changes
- Click Login Items
- If there are any items on the list, select them and click the minus button to remove them.
Remove third-party kernel extensions
Your Mac’s kernel communicates with the hardware through kernel extensions, also known as kexts. If you have any suspicious external kexts running, you should remove them because they could be the ones causing kernel panic. You can do it with Terminal:
- Open Terminal and type the following command: kextunload
- Find the kexts you want to remove (be careful not to remove system kexts!)
- In Terminal, run the command sudo kextunload /System/Library/Extensions/kext.kext (kext.kext should be replaced with the name of the kext you’re deleting)
- Press Enter, type your password, then press Enter again.
Note: macOS Big Sur and macOS Monterey no longer support third-party kernel extensions, so you shouldn’t worry about them if your Mac uses one of these newer systems.
Run Apple Diagnostics
If you can’t figure out why kernel error occurs — there doesn’t seem to be an issue with software, your RAM is fine, and you update your system regularly — run Apple Diagnostics (formerly Apple Hardware Test) to check for hardware issues. Once you’ve run the test, you’ll get a report with reference codes — check what they mean here and take your Mac to AASP or Apple Store if the report suggests to do so.
Here’s how to run Apple Diagnostics on an M1 Mac:
- Shut down your Mac
- Disconnect all peripherals
- Turn it back on by pressing and holding the power button
- Release the power button once you see the startup screen
- Press Command + D.
Here’s how to run Apple Diagnostics on an Intel Mac:
- Shut down your Mac
- Disconnect all peripherals
- Turn it back on and press the D key
- Once the progress bar or language selection appears, release the key.
Help your Mac so it keeps helping you
Kernel panic is basically your Mac saying “Hey, I’m struggling, I need to take a break now.” That’s one signal you should really pay attention to if you want your Mac to work for years to come. By regularly cleaning and maintaining your Mac with CleanMyMac X, you’ll probably avoid kernel panic in the first place. And for keeping an eye on your Mac’s health 24/7, install iStat Menus — it’s great for tracking system processes. Both apps are free to try with Setapp, a superb productivity toolkit for Mac and iPhone users.