Exclude individual file in shared .obsidian settings folder from iCloud sync

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:

  1. Select any note in Obsidian and invoke Show in system explorer to open your vault’s folder in Finder.
  2. Quit Obsidian and make sure it is closed on the other Mac(s) too.
  3. In Finder, press ⌘⇧. to show hidden files and folders and then navigate to the .obsidian folder inside your vault.
  4. Rename the workspace.json file inside the .obsidian folder to workspace.nosync.json. The .nosync part 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.
  5. Open Terminal.
  6. Type cd (with a space at the end) and then drag the .obsidian folder from Finder to the Terminal window, so that its path gets inserted. Press Return to change the current directory in Terminal to that folder.
  7. Paste the command ln -s workspace.nosync.json workspace.json and press Return. This creates a so-called symbolic link with the name workspace.json that points to our actual workspace file workspace.nosync.json. Since the symbolic link does not have .nosync in 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 separate .obsidian_iPhone settings 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 regular workspace file. EDIT: Apparently, the symbolic link also works with Obsidian Mobile on an iPhone, which is neat.
  • 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.
5 Likes

Thank you for making this! It worked great, including on my iPhone so the symlink seems to be working on mobile as well.

1 Like

That’s great to know, I’ve updated the guide. Thank’s for letting us know, @grantavery!

In Obsidian 1.0, the name of the workspace file has changed from just workspace to workspace.json. To avoid confusion, I’ve update the guide in the first post accordingly.

2 Likes