I live in iTerm2. On a normal day I have somewhere between five and twenty Claude Code sessions open, one per tab, each sitting in its own project. Some of them have been running for days. They know the codebase, they know what we tried yesterday and why it didn't work, and a couple of them have scheduled tasks and subagents going.
Then macOS decides it's time for an update.
After the restart iTerm2 politely reopens all my tabs, and every one of them is an empty shell prompt. To get back to work I had to go tab by tab: remember which project lived where, cd into it, run claude --resume, scroll through the session picker, find the right conversation, and repeat. With fifteen tabs that's a good chunk of the morning, and I usually got at least one of them wrong.
tmux people solved this years ago with tmux-resurrect. iTerm2 has nothing like it. I looked at the tools already out there with "claude-resurrect" in the name. Some are skills that restart a single session, some are for Ghostty or tmux, some live in editor terminals. None of them did the one thing I wanted with iTerm2: after a full reboot, put every session back into its own tab and resume it.
So I built it, and as a nod to the ones that came first, I called it Claude Resurrect 2.0.
What it does
You install it once:
curl -fsSL https://raw.githubusercontent.com/User0856/claude-resurrect-2.0/main/install.sh | bash From then on a small background agent quietly writes down which iTerm2 tab runs which Claude Code session, every 30 seconds. You don't have to remember anything before a reboot.
After the reboot you open iTerm2, open any tab, and type:
claude-resurrect Every session comes back in the tab it was in, in the folder it was started from, with its whole conversation. It runs the same claude --resume <session-id> you would have typed by hand, so the context is exactly what Claude saved. Sessions you named keep their names. If one is already running, it's skipped, so running the command twice does nothing bad.
It's one script in JavaScript for Automation, which ships with every Mac, so there's nothing else to install.
How it knows which session lived in which tab
This was the fun part to figure out.
Every running Claude Code session keeps a small file at ~/.claude/sessions/<pid>.json with its session ID, the folder it runs in, and when it started. That gives you "which sessions exist". iTerm2 can tell you, through its scripting interface, which terminal device every tab is attached to. And ps tells you which terminal device each Claude process is on. Join those three and you know that tab 3 of window 1 is running session 8f13a08c in ~/code/shop-api.
A few details turned out to matter more than I expected.
Shutdown is messy. When macOS reboots, iTerm2 closes and the Claude processes die over a second or two. If the autosave happened to run right in the middle of that, it would save a half-empty layout and that's what you'd get back. So a changed layout only gets saved after the agent has seen it twice in a row, and an empty one is never saved. A half-closed state never lasts long enough to count.
After the reboot, "newest" is the wrong snapshot. If you open one new Claude session before running the restore, the newest snapshot is that one lonely session. So by default it restores the last snapshot from before the boot. If instead sessions died during the current boot (iTerm2 crashed, or you quit it), it picks the newest one. Snapshots are kept, so claude-resurrect list and --snapshot 3 can always reach an older one.
Process IDs get reused. After a reboot, a stale session file can point at a PID that now belongs to some unrelated process. The tool checks that the process started when the file says it did, and ignores files written before the current boot.
Never type into a busy tab. Restoring works by typing cd <folder> && claude --resume <id> into the tab. It only does that if the tab is sitting at a plain shell prompt. Otherwise it opens a new tab next to it.
Built in one night, with Claude Code
I'm not going to pretend I hand-wrote this. I built it with Claude Code in one night, the way I build most things now: I explain what I want, it writes, and we argue about the edge cases.
My favorite moment came at the end. I rebooted my Mac for the first real test, opened iTerm2, ran claude-resurrect, and the Claude session that had just written the tool came back from the dead in its own tab and carried on talking to me. That's the whole pitch in one sentence, really.
The testing got a bit silly in a good way. I asked for a proper test instead of trusting it with my real sessions, so the test opens a separate iTerm2 window with five real Claude sessions, three in one folder and two in another, each with a name. It tells every session a secret code word (MANGO-4417, CEDAR-9032 and so on), kills all of them, runs the restore, and then asks each session what its code word was. Then it does it again with the whole window closed, which is what happens when iTerm2 doesn't restore your tabs. 41 checks, all passing.
It didn't get there on the first try. In one run the test hit Claude's "do you trust this folder?" prompt, pressed Enter, and Enter means "No, exit" there. Claude quit, and the test kept typing into the bare shell. I sent a screenshot back with the line zsh: command not found: Remember and a short question about whether it could see what it was doing. The fix: test folders now live where Claude already trusts them, and the test refuses to type into any tab where Claude isn't actually running. I like that story because it's an honest picture of working this way. The tool is good because I kept poking at it.
What doesn't come back
Resuming gets you what claude --resume gets you: the full conversation and context. Whatever was running at the moment of the reboot is gone. That means an answer that was mid-stream, background shells, subagents, and session-only scheduled tasks like /loop. In practice you tell Claude "pick up where you left off" and it does.
It also carries over a short list of launch flags, like --model, --permission-mode and --add-dir, and it never re-sends an initial prompt.
What's next
Right now it's macOS and iTerm2 only, because that's what I use every day. I kept the name generic on purpose. Finding the sessions already works for any terminal; a new terminal only needs two things, "read the tab layout" and "open a tab and run a command". Terminal.app and tmux are next on my list, then WezTerm and kitty. If you live in one of those and want to help, the issues are open.
It's MIT licensed and free. If your Mac has ever eaten your Claude sessions, give it a try:
User0856 / claude-resurrect-2.0
Restore all your Claude Code sessions after a macOS reboot with one command. Every session back in its own iTerm2 tab, with its full context. Like tmux-resurrect, for Claude Code. Zero dependencies.
Claude Resurrect 2.0
Reboot your Mac without losing a single Claude Code session.
One command brings every session back to its iTerm2 tab, in the right folder, with its whole conversation
Install · Use · Terminals · How it works · FAQ
Why this exists
iTerm2 is my favorite terminal. I keep a lot of Claude Code sessions open in it, one per tab, each in its own project, some running for days with a mountain of context behind them. Then macOS wants to restart, and every one of them is gone. Reopening them by hand means finding each folder and each session ID, tab after tab.
tmux users have had tmux-resurrect for years. iTerm2 had nothing. There are already a few tools called claude-resurrect, but none of them did what I needed with iTerm2: after a full reboot, put every session back into its own tab and resume it…
And if it saves you a morning, a star on GitHub would make my day.
