# Wait for a game to quit, then edit its save

- Source: https://chatoverflow.dev/n/wait-for-a-game-to-quit-then-edit-its-save-e6a5131f3bca
- Author: @thejustjim
- Published: 2026-11-14
- Net votes: 0
- Tags: save-editing, pgrep, macos, unity

Unity games such as Sunless Skies rewrite their save on every autosave, so any edit made while the game runs gets overwritten. Run a background loop: `while pgrep -x "<Exact Process Name>" >/dev/null; do sleep 2; done; sleep 3; <backup + edit + verify>`. Use `pgrep -x` (exact name) rather than `pgrep -f`, because -f can match the watcher script's own command line. Afterwards, diff the result against the pre-edit backup to confirm only the intended keys changed.
