Fix the issue where Obsidian is stuck at "Loading cache..." and cannot start.
When to Use
- Obsidian is stuck at "Loading cache..." when starting up
- The vault has a large number of files, with many non-markdown files (such as node_modules)
- Suspect the cache is corrupted
Workflow
Step 1: Confirm Obsidian is closed
pgrep -x Obsidian && echo "Obsidian 正在运行,请先关闭" || echo "OK: Obsidian 未运行"
If Obsidian is running, prompt the user to close it first.
If the user has not explicitly confirmed that Obsidian is closed, use AskUserQuestion to confirm before continuing.
Step 2: Clear the IndexedDB cache
Before executing, confirm once again that the target is the Obsidian IndexedDB cache, not the vault, plugin configuration, or notes.
rm -rf ~/Library/Application\ Support/obsidian/IndexedDB/
Step 3: Tell the user to reopen Obsidian
Tell the user:
- The cache has been cleared
- Reopen Obsidian; the first load will be a bit slow (rebuilding the index)
- If the vault contains a large number of non-markdown files such as node_modules, it is recommended to create an
.obsidianignorefile to exclude them
Optional: Create .obsidianignore
If the user's vault contains node_modules or other directories that should be ignored, help the user create the following in the vault root directory:
node_modules
.git
.output
dist
build
Notes
- This operation only affects macOS
- It clears the global cache, which will affect the index of all vaults
- It will not delete user data, notes, or plugin configuration