In macOS Monterey (and probably later), the Dropbox folder is moved from $HOME/Dropbox to $HOME/Library/CloudStorage/Dropbox. I'll use $DROPBOX to refer to the actual absolute path of the Dropbox folder.
The "traditional" way to sync $HOME/Documents is:
- move or copy $HOME/Documents (and its contents) into $DROPBOX -- this will sync in the usual way
- remove any remaining files from $HOME/Documents (including .localized and .DS_Store, etc.)
- sudo rmdir Documents # sudo is required to remove a "system" directory
- ln -s $DROPBOX/Documents $HOME
On macOS Monterey this fails -- immediately after #3 the OS creates an empty folder $HOME/Documents, and #4 fails.
Perseverance paid off, and I found a way to do this. You should have a good backup before starting.
- DROPBOX=$HOME/Library/CloudStorage/Dropbox # or wherever it is actually located
- move or copy $HOME/Documents (and its contents) into $DROPBOX -- this will sync in the usual way
- remove any remaining files from $HOME/Documents (including .localized and .DS_Store, etc.)
- cd $HOME
- sudo rmdir Documents ; ln -s $DROPBOX/Documents $HOME # two commands on one line
- in the finder, remove the "Documents" item from the sidebar
- in the finder, select "Dropbox" in the sidebar and drag its "Documents" into the sidebar
- in AppleMenu/ForceQuit force the Finder to relaunch
The key is using a single command-line in #5, so the link is created before the OS notices that Documents went missing.
If you don't do #8, the Finder won't see Documents until you reboot.
If you have multiple machines that will sync Documents, do the above on ONE machine, and do this on the others:
- Wait until $DROPBOX/Documents has synced with the first machine.
- DROPBOX=$HOME/Library/CloudStorage/Dropbox # or wherever it is actually located
- cd $HOME
- sudo mv Documents OldDocuments ; ln -s $DROPBOX/Documents $HOME # two commands on one line
- in the finder, remove the "Documents" item from the sidebar
- in the finder, select "Dropbox" in the sidebar and move its "Documents" into the sidebar
- in AppleMenu/ForceQuit force the Finder to relaunch
- Once you check that Documents is correct, do sudo rm -fr OldDocuments