A Microsoft file hosting and synchronization service.
I've just had to navigate trying to fix this for a few folks at my work. We initially thought this was triggered by upgrading to macOS27.x but some folks are still on macOS26.x and have been for a while, but still have had this extra OneDrive account pop up. Assuming its resulting from some semi-recent Microsoft Update now, but not confirmed.
looking in the users home directory in terminal, there are 3 symlinks.
ls -al ~/ |grep lrwx
One for Desktop, one for Documents and one call OneDrive - <company name>. The Desktop and Documents link to the original OneDrive and the last symlink pointed to the newly created OneDrive - <companyname>(2)
In OneDrives settings in its GUI, you could see both locations, but the old one was a 'Disconnected location' and only option is to remove. If you remove it - it archives the local contents into a ~/Library/CloudStorage location.
in the terminal you can't CD into the Desktop or Documents folder.
you also can't remove them or re-symlink them yourself (at least not on our systems)
this is some SIP-like protection.
you can run
ls -ldO@e ~/Desktop ~/Documents
lrwxr-xr-x@ 1 bob staff uchg 59 Aug 26 13:18 Desktop -> /Users/bob/Library/CloudStorage/OneDrive-foocomp/Desktop com.microsoft.OneDrive.KnownFolderVolFs 22 com.microsoft.OneDrive.OriginalFolder 32
Both symlinks have the uchg (user immutable) flag set by OneDrive's Known Folder Move (KFM) feature, which prevents even root (sudo) from modifying or unlinking them until the flag is cleared.
to start to fix things
- quit OneDrive (killall OneDrive)
- then run this to clear the flags
chflags -h nouchg ~/Desktop ~/Documents
3 then remove the symlinks and replace with standard directories
rm ~/Desktop ~/Documents
mkdir ~/Desktop ~/Documents
4 Then reopen OneDrive, go to settings > Sync and Back up > Manage Back Up
Re-enable the Documents and Desktop backups and click save
that should reinstate the symlink'd directories and begin to sync things again. give it some time to complete.
Most data should reappear and in finder you'll be abke to write to desktop and documents again.
for any missing docs, look in ~/Library/CloudStorage/..... for the archived folder - move docs across and then (once you are sure) remove that cache to free a bit of disk space
This process seems to be working for us - but now need to work out a way to do this at scale or via policy.