---
title: "iCloud Concurrent Write: ' 2.md' Duplicate Files"
aliases: [icloud-space-2, icloud-duplicate-files]
tags: [icloud, macos, concurrency, filesystem]
sources: [memory-compiler]
created: 2026-05-05
updated: 2026-05-05
---

# iCloud Concurrent Write: ' 2.md' Duplicate Files

When two devices write to the same iCloud Drive file at the same time, iCloud resolves the conflict by keeping both versions. The second version gets a space-number suffix: `filename 2.md` (space before the number, not a hyphen or underscore).

## Key Takeaways

- Glob pattern to find duplicates: `* 2.md` (space before 2)
- Distinct from `.git` merge conflicts — this is iCloud's own conflict resolution
- Can silently accumulate: if not cleaned up, you may get `filename 2.md`, `filename 3.md`, etc.
- Most common in wiki/note systems where two machines flush to iCloud roughly simultaneously

## When It Happens

- Machine 1 is writing a file while Machine 2 is also writing the same file
- The memory-compiler multi-device workflow is a classic trigger: flush.py on Machine 2 writes the daily log; compile.py on Machine 1 also writes to wiki notes — both during the same ~21:00 window

## Detection & Cleanup

```bash
# Find all iCloud duplicate files (space-2 suffix)
find . -name "* 2.md"

# Or with glob (zsh)
ls **/*\ 2.md
```

The memory-compiler runs a LaunchAgent dedup at **09:00** and **21:30** that removes these duplicates automatically.

## Distinction from icloud-git-sync-conflict

| Scenario | File produced |
|----------|--------------|
| iCloud concurrent write (any file) | `filename 2.md` |
| git conflict in iCloud-synced repo | `filename.md` with `<<<<<<` markers |

See [[wiki/concepts/icloud-git-sync-conflict|icloud-git-sync-conflict]] for the git-specific variant.

## Related

- [[wiki/concepts/icloud-git-sync-conflict|icloud-git-sync-conflict]] — git conflict markers in iCloud-synced repos
