MacOS – Delete a file locally, but keep it in iCloud

icloudmacos

I have a file on my desktop that is now synced with iCloud using the new feature of macOS.

I would like to delete it, but keep a copy of it in the iCloud.

I am nervous that if I simply delete it from my Mac, it will also be deleted in iCloud.

Is there a way to keep the iCloud copy, but delete the local copy?

For example, here are two directories on my desktop, one is only in the cloud, the other is both in the cloud and saved locally:

enter image description here

I would like to make the Personal Docs folder become like the Datasets folder

Best Answer

As Andreas mentioned in his answer, brctl evict purges the files. But for me, it seems to work permanently. Even purges recursively through folders. Maybe it is because I purged 40GB of data, hard for iCloud to reset in a heartbeat

>brctl evict SuperBigNestedFolder
evicted content of 'SuperBigNestedFolder/'

Nice!

BUT, when iCloud evicts the files it also throws away all metadata. This cripples Spotlight by removing the ability to search for text found inside popular file formats such as word, pdf, pages, keynote, or txt.