Can I exempt a single file in iCloud directory from deleting locally?

Solution 1:

Unfortunately, there is currently no file or folder level controls for storage optimization. It's an all or nothing feature, which is really too bad.

Here are your options as I see them:

Option 1: Turn off Storage Management

System Prefs -> Apple ID -> (uncheck) Optimize Mac Storage

By default this keeps everything. You can Right click -> Remove Download for any files in an iCloud drive you don't want to keep locally. But you'll have to manage them by hand.

Option 2: Move the file out of an iCloud folder

Storage Management will stop deleting the file, but it also stops syncing.

Option 3: Use another service

You could keep Storage Management on for most files but move the things you need more control over into another cloud service (ie dropbox) that does what you want.

Option 4: Open the file frequently

In theory Storage Management will keep files you "open frequently". You could probably even do so automatically if you're comfortable with a command line:

For Example:

export VISUAL=nano
crontab -e

0 12 * * * touch -a /Users/yourname/path/to/file

Should make the OS think you've used the file every day at noon. Make sure to pick a time when your computer is on.