Sub topic 7
Saving disk space with Optimize Mac Storage
This chapter assumes you have turned on iCloud Drive, can find files in Finder, and know your iCloud storage plan. It explains how Optimize Mac Storage moves files off your disk, and how to check and control the result.
What the setting does
Optimize Mac Storage lets macOS keep the full copy of your files in iCloud and remove the local copy when the Mac runs low on disk space. The file stays in Finder with its name, icon, and size. Opening it makes the Mac download it again.
macOS decides what to remove. It generally removes files you have not opened recently first, and it acts only when free space gets low. With plenty of free space, you may see no change at all.
The setting also affects other iCloud data, such as Photos originals and some Mail attachments, depending on your configuration. This chapter covers iCloud Drive files.
Turning it on or off
- Open System Settings and click your name.
- Choose iCloud, then Drive.
- Switch Optimize Mac Storage on or off. On some macOS versions the option is under Options in the iCloud Drive pane.
If you turn it off, files that are only in the cloud stay that way until you open or download them. They do not all download at once.
How a file moves between states
A file in iCloud Drive is in one of two states on your Mac. It is either fully downloaded, or it is a placeholder that points to the cloud copy. Optimize Mac Storage changes files from the first state to the second when space is needed. Opening a placeholder changes it back.
Checking the effect
You can see the difference between a file's size and the space it uses on disk. Placeholders report their full size in Finder but use very little disk space. Run this in Terminal to compare:
cd "$HOME/Library/Mobile Documents/com~apple~CloudDocs"
ls -lh
du -sh .ls -lh shows the logical sizes. du -sh . shows the space actually used on disk. If du reports far less than the sum of the file sizes, many files are cloud-only. Avoid reading file contents from Terminal with tools such as cat or cp on placeholders in bulk, because that can trigger many downloads at once.
Risks and limits
- You need a connection to open cloud-only files. On a plane or on weak Wi-Fi, a placeholder may not open.
- Large downloads take time. A video that was removed locally must download completely before some apps can use it.
- Scripts and backups can trigger downloads. A backup tool or a search indexer that reads every file can pull the whole library back down and fill the disk.
- It is not a backup. Deleting a file deletes it from iCloud and your other devices too. It stays in Recently Deleted for a limited time.
If a particular file must always be available offline, you can keep it downloaded. That is covered in a later chapter, after the status icons.
Exercise
Your Mac has plenty of free space, and you turned on Optimize Mac Storage, but all your iCloud Drive files still use their full size on disk. Is something wrong?
Show answer
No. macOS removes local copies only when the Mac runs low on disk space, so with plenty of free space the files can stay fully downloaded.
Exercise
Why can du -sh report much less than the total file sizes shown by ls -lh in your iCloud Drive folder?
Show answer
Cloud-only placeholders show their full size in file listings but use almost no disk space, so du counts only the data that is actually stored on the Mac.