Accidentally deleted files and folders from Mac system, how to restore?
Most regular users appreciate that system files and folders are important and should not be accessed or modified. Despite this, various searches on the internet lead to websites suggesting that they must replace or remove data within these folders when experiencing certain problems. Therefore, occasionally, system files or folders are deleted accidentally, thus causing basic features to malfunction or stop. This situation might seem irrecoverable, however, modern Macs include a hidden recovery partition, which is usually created automatically when installing the operating system and stores system installation files. The hidden partition is effectively equivalent to a Mac OS X installation CD/DVD.
A big advantage of using this method is that it will not impact on your private data. When reinstalling the operating system from the recovery partition, the hard disk is not erased and the user's home folder will remain untouched. Although, the hidden partition is not corrupted (as might be the case with other system files), there can sometimes be issues relating to the recovery partition. Therefore, a feature called 'internet recovery partition' is also available. This is an alternative way to restore system files using a recovery partition stored on Apple servers. In this article, we describe the above methods plus a number of other options to restore deleted/corrupted system files and folders.
Table of Contents:
- Restore deleted system files and folders via Recovery partition
- Alternative methods to restore deleted system files
Restore deleted system files and folders via Recovery Partition
The most efficient way to restore deleted files is using the Recovery Partition. This method replaces missing system files and leaves your personal data untouched. First, completely shut down the Mac (no lights are displayed and you cannot hear fans spinning). Turn on the Mac and hold down the Command and R keys at the same time. Keep holding the combination until the macOS Utilities window appears.
From the menu, select the Reinstall macOS option. Do not worry about your personal files - this method will not erase your hard drive.
You will be prompted to confirm your actions. Click Continue. You will need to agree to Apple's terms and conditions.
The next window will ask you to select the storage location. Choose the internal hard drive and click Install. This process may take some time, depending on the internal hard drive speed.
If you are unable to use the recovery partition, another option is Internet Recovery. For more information, follow this detailed guide about how to reinstall macOS using Internet Recovery.
Alternative methods to restore deleted system files
If you are unable to reinstall the entire operating system (or do not wish to), there are a number of alternative methods. In some rare cases, these might fail, however, you will not lose any data, do not be concerned.
- To restore missing or corrupted files using Time Machine backup, read the detailed guide.
- Copy missing or corrupted files from another trusted device. Note, however, that you must be sure that the operating system versions of both systems match, otherwise this method might cause additional issues. Manually copy files from the recovery partition using Terminal:
- Shut down the computer, and then boot it to recovery mode in a similar way (by holding down Command and R while launching the Mac).
- When the macOS Utilities window appears, click on Utilities in the menu bar at top of the screen and then select Terminal.
- When the Terminal app launches, determine the actual volume name by typing df and pressing Return to execute.
- Make a copy of the /bin folder associated with the hard disk by executing the following command: cp -a /bin /Volumes/disk name (replace 'disk name' with the name of the Mac disk).
- When Terminal has finished the task, close it and restart the Mac by clicking the Apple logo in the menu bar at the top of the screen. Note that after performing this method, you must update your system again.