Situatie
Modern versions of Mac OS X no longer need you to repair disk permissions. However, that’s not the only issue that can occur with a disk or file system. Mac OS X contains a variety of tools for repairing disk, partition, and file system errors.
These options work like chkdsk on Windows, checking for disk and file system errors and repairing them. You can perform a check from within Mac OS X, but it may sometimes be necessary to use recovery mode to fix problems. In a worst-case scenario, you may have to manually run fsck commands from a terminal in single-user mode.
Solutie
You can perform a disk health check from the Disk Utility application included with Mac OS X. Apple updated this utility’s interface on Mac OS X 10.11 El Capitan, so it’ll look a bit different from the screenshots below if you’re still using and older version of Mac OS X.
To launch it, you can press Command+Space to open Spotlight search, type “Disk Utility”, and press Enter. Or, you can navigate to your Applications folder, double-click the “Utilities” folder, and double-click the “Disk Utility” shortcut.
- In the Disk Utility application, select the disk or partition you want to check — the system partition is named “Macintosh HD” by default — and click the “First Aid” button.
- You can either run the First Aid function on an entire disk, or an individual partition on that disk. It depends which you select in the sidebar.
- Click “Run” and your Mac will check the disk you selected for errors. If it finds any errors, it will attempt to automatically fix them for you.
- You can click the “Show Details” drop-down message to view detailed information about any errors it encounters. You’ll see messages like “Storage system check exit code is 0” and “File system check exit code is 0” here. An exit code of “0” is a good thing, and means no errors were found.
- Boot into Safe Mode
One simple way to fix such errors is to boot your Mac into Safe Mode. Safe Mode, sometimes called “Safe Boot,” contains an automatic startup check and repair that can fix these problems. To do this, restart your Mac and hold “Shift” while it’s booting. Sign in with your password and your Mac will then check your disks. This will make the login process take longer than normal, so be patient. When it’s done logging in and you see a desktop, the disk check is done. You can reboot your Mac at this point.
Run First Aid in Recovery Mode
Ideally, that should be the end of it — especially if you used the safe mode trick above. However, in some cases, your Mac may find disk or file system problems and be unable to repair them when you perform the above steps. This is because it’s running in “live mode” — examining the disk while the operating system is running from it. It can’t make changes to that system drive while it’s running from it.
The solution is to boot into a special recovery mode. From there, you can use Disk Utility in the same way. Your Mac will be able to fix errors on your system drive from recovery mode.
To do this, restart your Mac. Press and hold the “Command+R” keys while it’s booting. You’ll see a progress bar appear, and you can release the keys after you do. Your Mac will load straight into recovery mode. (If recovery mode doesn’t appear, restart your Mac and try pressing the keys again.)
In OS X Recovery, click the “Disk Utility” shortcut to launch the Disk Utility here. Select the drive or partition you need to repair and click the “First Aid” button. The Disk Utility interface is the same one you’ll see on your Mac OS X desktop, but run it from here and it’ll be able to repair problems with your system drive.
Use fsck in Single-User Mode
In some cases, even Safe Mode or Disk Utility in OS X Recovery won’t be enough to fix problems. You may need to boot your Mac into single-user mode and run the fsck (file system check) command the old-fashioned way. You don’t need to do this if any of the above steps worked. This is the thing you should try last, as Disk Utility in the recovery environment may work better and be more capable.
To do this, start your Mac in single-user mode. Restart it, and then press and hold the Command+S keys while it boots.
You’ll enter single-user mode, which will provide you with a text-mode terminal. Type the following command into the terminal and press Enter to start a file system check:
/sbin/fsck -fy
The command will run through several phases of checks. When it’s done, you’ll see a message saying “** The volume [name] appears to be OK” if everything is fine.
If it found problems, you’ll see a “***** FILE SYSTEM WAS MODIFIED *****” message. This indicates the fsck command found and fixed problems. The fsck command may find additional errors after repairing the first batch of errors, so Apple recommends you run the fsck command again if it found and fixed problems. Run the above fsck command over and over until you see a “** The volume [name] appears to be OK” message.
When the fsck command says your disk is okay, type the following command at the terminal and press Enter: reboot
Your Mac will reboot, returning you to the usual login screen. The above steps should only be necessary if you’re experiencing errors with your Mac. Assuming everything is fine, you don’t need to regularly perform disk first-aid checks. However, if you do want to run a check, you can just do it with Disk Utility from within Mac OS X. You don’t need to reboot into any other environments unless there’s an error on a system drive you need to fix.