Language
November 27, 20263 min read

Resume Claude Code Session With tmux (Step by Step)

Run Claude Code inside a named tmux session with tmux new -A -s claude. Detach with Ctrl+b d, reattach later, and use claude --continue if you need to reopen the conversation itself.

The tmux session keeps the process alive. Claude Code's resume commands bring back the conversation.

Macky puts your Mac's terminal on your iPhone, so you can attach to the same tmux session from your phone.

Start Claude Code inside tmux

Create a named session, or attach to it if it already exists:

tmux new -A -s claude

The -A flag attaches if the session exists. Run this same command every time. Then start Claude Code:

claude

Press Ctrl+b, release it, and press d to detach. Programs in the session keep running after you detach or your SSH connection drops. Use tmux ls to see what's running. To reattach, use:

tmux attach-session -t claude

Don't run tmux new from inside a session. You'll get a nesting error.

Resume the conversation with Claude Code

If the Claude Code process ended, reopen the conversation with one of these:

CommandWhat it does
claude --continueReopens the most recent session in the current directory
claude --resumeOpens the session picker
claude --resume <name>Resumes a named session
claude --resume <session-id>Resumes the session with that ID
claude --from-pr <number>Opens the picker filtered to sessions linked to that pull request

Resuming keeps the same session ID and appends new messages. Pass other flags again, because Claude Code doesn't restore them.

Sessions started with claude --remote-control resume the same way. The details are in Claude Code Remote Control.

Reattach from your iPhone

Macky opens real shell sessions on your Mac, so tmux attach-session -t claude works from your iPhone the same way it does at your desk.

Macky terminal on iPhone with a shell session open on a Mac

The key bar gives you Esc, Tab, Ctrl, and arrow keys. The connection is end-to-end encrypted and needs no open ports or VPN.

What happens after a reboot

A reboot ends your tmux sessions. The tmux-resurrect and tmux-continuum plugins can restore a saved layout afterward. A restored pane may still need claude --continue to bring the conversation back.

If the session doesn't show up

If a session is missing from --continue or the picker, check these:

  • You're in the same directory or worktree where you started it.
  • It wasn't created with claude -p or the Agent SDK. Those sessions are left out of the picker and --continue.
  • You pass the session name or ID directly.

A session started with -p can still be resumed by its ID.

Notifications inside tmux

Inside tmux, Claude Code checks tmux for terminal status notification support, and allow-passthrough has no effect. If you rely on those notifications, start the session outside tmux.

Reaching the Mac over SSH first? See How to SSH into a Mac.

FAQ

Can I resume a Claude Code session after closing the terminal?

Yes. Claude Code stores sessions locally. Run claude --continue in the same directory to reopen the most recent one, or claude --resume to pick from a list.

Does a tmux session survive a reboot?

No. Sessions aren't saved when you restart the computer. The tmux-resurrect and tmux-continuum plugins can restore your layout after a reboot. Then you resume the conversation with claude --continue.

How do I detach from tmux without stopping Claude Code?

Press Ctrl+b, release it, and press d. The session keeps running in the background. Reattach with tmux attach-session -t claude.

What's the difference between claude --continue and claude --resume?

claude --continue reopens the most recent session in the current directory. claude --resume opens a picker, or takes a session name or ID.

Try Macky

Connect to your Mac terminal from your iPhone.