Catalina Overwriting Symlinked Document Folders

I use OneDrive for syncing and I create symlinks pointing to the Documents and Desktop folders in my OneDrive. I replace the default MacOS folders with the symlinks in order to make syncing of those automatic.


Up until Catalina, this worked great. However, now every time I log in these symlinks are replaced with local folders. Just the Documents and Desktop, not Downloads.


Any idea what new security feature is probably causing this? Any suggestions/workarounds?

Replies

This is pretty standard behaviour for the past several years. When Mac OS X first came out, it was much more of a pure UNIX operating system and people often hacked up the internals with symlinks. But this hasn't been safe for at least a decade. The only change now is that Documents and Desktop have become "special" folders that can no longer be hacked up like that.


The only workaround is not to do that. Apple supports Documents and Desktop syncing with iCloud Drive. Whether that feature works or not is an entirely different question. Given that many users will have this feature enabled, Microsoft is wise to not allow it as chaos would ensure in about 12 milliseconds. See if you can hack up OneDrive in some other fashion.

It has been working great for years. Annoying Apple is doing this without giving an option to opt out. I think it could also be viewed as them pushing iCloud and an anticompetitive practice.

I'm pretty sure that support for symbolic links to system-controlled, synced folders isn't an anticompetitive practice. Do you actually have Documents and Desktop turned on in iCloud Drive? If so, you could try turning that off. But even so, Apple has never supported symbolic links for any folder having any special "meaning" to the system. If you had ever been lucky enough to find a place where it did work, that just meant you were lucky. Your luck ran out. People who play with symbolic links always have their luck run out eventually.

Run script on startup to delete / replace. I'm using Dropbox for cloud storage (as iCloud doesn't work pretty much anywhere outside of Apple ecosystem, and even there it lacks lots of features compared to competitors), so my Documents and Desktop folders are there.

Just create a dead-simple shell script to delete / remap folders on startup and run it either through launchd or add yourself to sudoers and add it to login startup items. Either way you'll have it auto-remapped after every startup and Catalina doesn't mess up your symlinks any other time outside of starting up.