Sub topic 10
Restoring files and folders
This chapter covers getting back a deleted file, an older version of a file, or a whole folder from a Time Machine backup. It assumes you have finished the first backup (see the setup chapter) and can use Finder and open Terminal. The command-line section uses only read-only commands plus cp.
How a restore works
Time Machine keeps many dated copies of your files. When you browse the backup, you are looking at your folder as it existed at a chosen moment. Restoring copies the item from that moment back to your Mac. It does not delete the backup, and it does not touch other files.
The backup can come from one of two places:
- The backup disk or network share. This holds the full history, so it is the normal source for older files.
- Local snapshots on your Mac's startup disk. These are recent points in time that Time Machine keeps even when the backup disk is disconnected. They are covered in the local snapshots chapter.
If the backup disk is not connected, Time Machine shows only the local snapshots. Connect the disk (or mount the network share) before you search for older versions.
Restoring in Finder
Follow these steps to restore a deleted or changed item.
- Open a Finder window and go to the folder that held the item. If you deleted it, open the folder it was in. Time Machine opens on the folder you have in front.
- Enter Time Machine. Click the Time Machine icon in the menu bar and choose Browse Time Machine Backups. If the icon is missing, turn it on in System Settings under Control Center.
- Move through time with the up and down arrows beside the window, or click a tick on the timeline at the screen edge. Ticks are dated backups. The arrows jump to backups where this folder changed.
- Select the item. Press the Space bar to open a Quick Look preview. This lets you confirm you have the right version before restoring.
- Click Restore. The item returns to its original location.
To put the item somewhere else, Control-click it and choose Restore to…. Then pick a destination folder. This is the safer choice when you only want to compare an old version with the current one.
You can restore several items at once. Select a whole folder to bring back everything in it as it was on that date.
When a file with the same name exists
If the original location already has an item with that name, Time Machine asks what to do:
| Choice | Result | Use it when |
|---|---|---|
| Keep Both | The restored copy is added, and the current file stays. The name of one of them changes. | You are not sure which version you want. |
| Replace | The current file is overwritten by the old version. | You want to discard recent changes. |
| Skip | That item is not restored. Other items in the batch still are. | You restore a folder and some files are fine as they are. |
For a file you edited, Keep Both is usually right. Replace cannot be undone from Time Machine itself, although an earlier backup of the replaced file may still exist.
Restoring inside supported apps
Some apps add their own Time Machine browsing. Photos, for example, restores a whole library through the same timeline when the library is open. The app's window moves through time instead of Finder's. The rest is the same: pick a date, select what you want, click Restore. Quit and reopen the app afterward if it does not show the restored data.
For apps without support, restore the data file from Finder. For example, restore a document, an app's library package, or a file under ~/Library. Quit the app first. An app that is writing to its data while you restore can corrupt it.
Finding items you cannot locate
- The file is not in the folder you expected. Scroll back until the file appears. You can also use the search field in the Time Machine window, which searches the dated view you are looking at, not every date at once.
- A hidden folder such as
~/Libraryis not visible. In Finder, choose Go, hold Option, and pick Library. Then enter Time Machine from that window. - The file was never backed up. Check whether the item or its parent folder was excluded (see the exclusions chapter). Excluded items have no history.
- The backup is too new. Retention thins old backups. Hourly backups last 24 hours, daily backups last a month, and weekly backups last until the disk is full. An item deleted and backed up only briefly may not be recoverable once its backups are removed.
Encrypted and network backups
An encrypted backup disk asks for its password when you enter Time Machine. Without the password, you cannot browse it. Store the password in a password manager, not only in Keychain on the Mac you may be restoring.
For a network share, the share must be mounted. If Time Machine says it cannot find the backup, connect to the server in Finder first (Go then Connect to Server), then try again. Browsing is slower over Wi-Fi because Time Machine reads the backup image over the network.
Restoring from Terminal
Sometimes Finder is unavailable, or you want to script a restore. You can find the latest backup path with tmutil and copy files with cp.
tmutil latestbackupThe output is a folder representing the newest backup. The layout under it depends on the disk format and macOS version, so list it before you pick a path:
backup="$(tmutil latestbackup)"
ls "$backup"Once you find your file in that tree, copy it to a safe place such as the Desktop. Use -p to keep permissions and dates:
cp -p "$backup/path/to/report.pdf" ~/Desktop/report-restored.pdfReplace path/to/report.pdf with the real path you saw in the listing. The $backup variable is quoted because backup names often contain spaces.
Copying with cp does not restore extended attributes and some special metadata. For documents this rarely matters. For apps or packages with special attributes, use the Finder restore instead.
Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| Time Machine shows no dates | Backup disk is not connected or not mounted | Connect the disk or mount the share |
| Restore button is greyed out | The item is a read-only view such as a system folder, or you lack permission | Use **Restore to…** into your home folder |
| "The operation can't be completed" while restoring | The destination disk is full | Free space, or restore to another disk |
| Restored file will not open | App is still running, or the file was saved mid-write | Quit the app and restore an earlier version |
| Password prompt keeps failing | Wrong backup password | Use the password set when encryption was enabled |
Exercise
You deleted a spreadsheet yesterday and later saved a new file with the same name in the same folder. You want both versions. What do you choose when Time Machine asks about the conflict, and why?
Show answer
Choose Keep Both. Replace would overwrite the new file with the old one, and Skip would restore nothing. Keep Both adds the restored copy next to the current one, so you can compare them. Restoring to a different folder with Restore to… also avoids the conflict.
Exercise
You enter Time Machine and see only the last day of backups, but you need a file from three weeks ago. What is the most likely reason, and what should you do?
Show answer
The backup disk is probably not connected, so Time Machine shows only local snapshots, which cover recent hours. Connect the disk (or mount the network share) and enter Time Machine again to see the full history.
Exercise
Which command prints the path of your newest backup, and what must you grant Terminal before you can read files inside it?
Show answer
tmutil latestbackup prints the path. Terminal needs Full Disk Access, set in System Settings under Privacy & Security.