I find it extremely convenient to use the same .obsidian settings folder for both of my Macs, so that any changes I make to hotkeys, css snippets, etc. are automatically kept in-sync between the two Macs.
However, I vastly prefer not sharing the same workspace.json file, because I usually keep 1-5 notes open in Obsidian (with the help of the great Sliding Panes plugin), and these are generally different ones on each Mac.
Here’s how you can selectively exclude the workspace.json file (or any other file that you prefer to keep separate between your Macs) from iCloud sync:
- Select any note in Obsidian and invoke
Show in system explorerto open your vault’s folder in Finder. - Quit Obsidian and make sure it is closed on the other Mac(s) too.
- In Finder, press
⌘⇧.to show hidden files and folders and then navigate to the.obsidianfolder inside your vault. - Rename the
workspace.jsonfile inside the.obsidianfolder toworkspace.nosync.json. The.nosyncpart in the file name causes it to be excluded from iCloud sync, which also results in it getting deleted from your devices other than the current Mac. - Open Terminal.
- Type
cd(with a space at the end) and then drag the.obsidianfolder from Finder to the Terminal window, so that its path gets inserted. Press Return to change the current directory in Terminal to that folder. - Paste the command
ln -s workspace.nosync.json workspace.jsonand press Return. This creates a so-called symbolic link with the nameworkspace.jsonthat points to our actual workspace fileworkspace.nosync.json. Since the symbolic link does not have.nosyncin its name, it will get synced by iCloud to your other devices (but only as a symbolic link file, without the content of the file it is pointing to).
When you now open Obsidian on your current Mac, it will use the existing workspace.nosync.json file. When you open Obsidian on another Mac, it will create a new workspace.nosync.json file on that machine and keep saving to that file.
Now that I finally got this to work the way I wanted, I might also keep individual other files separate between my two Macs (such as starred.json), but for the workspace.json file it was bugging me the most.
Note:
-
I use a separateEDIT: Apparently, the symbolic link also works with Obsidian Mobile on an iPhone, which is neat..obsidian_iPhonesettings folder for Obsidian Mobile on my iPhone, so I don’t know if this workflow would also work there or if Obsidian Mobile would, for instance, simply overwrite the symbolic link file with a regularworkspacefile. - The same applies to syncing with a Windows PC, except here I would be tremendously surprised if iCloud on Windows magically handled the symbolic link from macOS properly.