Apple - Can't login because of kernel panic
This answer assumes:
- your internal drive is full and this is why you can't log in
- you do not have access to another Mac
- you do not have another drive you can boot from.
The following steps will allow you to delete what we call a sleepimage
file. These are usually quite large and should free up enough space for you to be able to log back in.
Note that while this can be done in much fewer steps (steps 4 to 10 could be removed and step 11 could contain a much longer file path), I've deliberately split this up to reduce the risk of making a typo and to make it easier to understand.
Deleting your sleepimage file via Single User Mode
- Boot into Single User Mode by restarting your Mac and pressing and holding ⌘ + S as soon as you hear the startup chime
- Keep these keys down until you see a black screen with white text
- Mount your drive by typing in exactly:
/sbin/mount -uw /
(note there is a space after the 't' and again after the 'w') and then pressing the enter key - Now list what's there by typing in
ls
and pressing the enter key - You should see a list of files and directories
- Now type in
cd private
(note there is a space after 'cd') and press the enter key - Now type in
cd var
(note there is a space after 'cd') and press the enter key - Now type in
cd vm
(note there is a space after 'cd') and press the enter key - Now type in
ls
and press the enter key - Hopefully you will see that you have a
sleepimage
file located here (this is what we're going to remove) - Now type in
rm sleepimage
(note there is a space after 'rm') and press the enter key - Now reboot your Mac by typing in
reboot
and then pressing the enter key
Hopefully this will free enough space for you to be able to login. If so, then take the time to remove any other data you don't need. If not, message me and we'll go from there.
NOTE: If your Mac doesn't reboot after Step 12, feel free to switch it off with the power button.
IMPORTANT: - You really should have a backup regime in place! Buy yourself an external USB hard drive and start using Time Machine for backups!
Deleting downloads via Single User Mode
Since you know you have items in your Downloads you can delete, these steps will help you do that from Single User Mode.
- Follow Steps 1 to 5 from Deleting your sleepimage file via Single User Mode above
- Now type in
cd users
(note there is a space after 'cd') and press the enter key - Now type in
ls
and press the enter key - You should see a list of users for your Mac.
- Now, if we assume your username is Marvin, type in
cd marvin
(note there is a space after 'cd'). Obviously, if your username is something else, then use that instead of marvin! - Press the enter key
- Now type in
ls
and press the enter key - You should see a number of folders listed. Type in
cd downloads
(note there is a space after 'cd') and press the enter key - Now type in
ls
and press the enter key - You should see a list of files and folders. Now use the
rm
command to remove items you don't want. - For example, if you have an item called Installer.dmg, you would remove it by typing in
rm Installer.dmg
(note there is a space after 'rm') and pressing the enter key - Once you've removed enough items to free up space, reboot your Mac by typing in
reboot
and then pressing the enter key
Note: If an item has a space in its name (e.g. Install XYZ.dmg), then the command you would need to enter is rm Install\ XYZ.app
. That is, I have used a backslash \
before the space!
Deleting Applications via Single User Mode
If you want to remove applications, then follow these steps:
- Follow Steps 1 to 5 from Deleting your sleepimage file via Single User Mode above
- Now type in
cd applications
(note there is a space after 'cd') and press the enter key - Now type in
ls
and press the enter key - You should see a list of applications and folders. Now use the
rm
command to remove items you don't want. - For example, if you have an item called XYZ.app, you would remove it by typing in
rm XYZ.app
(note there is a space after 'rm') and pressing the enter key - Once you've removed enough items to free up space, reboot your Mac by typing in
reboot
and then pressing the enter key
Note: If an item has a space in its name (e.g. Microsoft Word.app), then the command you would need to enter is rm Microsoft\ Word.app
. That is, I have used a backslash \
before the space!