Codonic

hopsesh guide · Claude Code

How to move a Claude Code session from Windows to Mac (or Mac to Windows)

C--Users-alice-src-webapp on Windows, -Users-alice-src-webapp on the Mac. The manual copy, every path trap between the two systems, and a move that converts them.

Where the session is on each side

Windows macOS
Claude Code root %USERPROFILE%\.claude ~/.claude
Repository C:\Users\alice\src\webapp /Users/alice/src/webapp
Project folder C--Users-alice-src-webapp -Users-alice-src-webapp
Session ...\projects\C--Users-alice-src-webapp\<id>.jsonl .../projects/-Users-alice-src-webapp/<id>.jsonl

The project folder is the working directory with every character that isn’t a letter or digit replaced by -, so the drive letter’s colon and each backslash become dashes. Codex is the same on both: %USERPROFILE%\.codex\sessions\YYYY\MM\DD\ and ~/.codex/sessions/YYYY/MM/DD/.

Copy it from Windows to a Mac by hand

  1. Move the code. Commit and push on Windows, then clone or pull on the Mac. Check line endings: a Windows checkout with core.autocrlf=true and a Mac checkout without it show every file as changed if you copy the folder instead of using git.

  2. Quit the session on Windows so the copy doesn’t fall behind.

  3. Copy the transcript into the Mac’s project folder for the repository’s path there. With OpenSSH Server running on the Windows PC:

    mkdir -p ~/.claude/projects/-Users-alice-src-webapp
    scp 'win-pc:.claude/projects/C--Users-alice-src-webapp/<id>.jsonl' ~/.claude/projects/-Users-alice-src-webapp/

    Copy the session’s side folder, <id>/, too, if there is one.

  4. Rewrite the paths (below), then cd ~/src/webapp && claude --resume <id>.

Mac to Windows is the same in reverse, with the Windows project folder name and %USERPROFILE%\.claude\projects.

Why the paths are the hard part

Claude Code records absolute paths everywhere in a transcript: the working directory, every file it read or edited, every command it ran in a folder. Resume a Windows session on a Mac without changing them and Claude starts out believing it is in C:\Users\alice\src\webapp, and its first edits can aim at paths that don’t exist.

A plain search-and-replace runs into the details:

  • JSON escaping. Inside the file a backslash is written twice. The path you search for is C:\\Users\\alice\\src\\webapp, not C:\Users\alice\src\webapp.
  • Separators after the prefix. Replacing the prefix turns C:\\Users\\alice\\src\\webapp\\src\\app.ts into /Users/alice/src/webapp\\src\\app.ts. Every backslash after it has to become / too, but only in paths, not in regular expressions or escaped strings that happen to contain backslashes.
  • Case and drive letters. Windows paths are case-insensitive and may appear as c:\ or C:\, and with forward slashes in some tool output.
  • Prefixes that match too much. C:\\Users\\al also matches C:\\Users\\alice2.
  • What must not change. Session ids, message ids and Claude’s signed thinking blocks must stay byte for byte, or the session fails to load or loses its reasoning.

Going from Mac to Windows, every / in a path becomes \\, and a path inside your home folder needs a drive letter.

What else differs

  • Shell commands. The session’s history has PowerShell or cmd commands that mean nothing to zsh, and the other way round. Claude adapts once it notices, but tell it in your first message: “We’re on macOS now.”
  • Line endings in the repository, as above.
  • Tools and paths outside the repository, such as C:\tools\ or /opt/homebrew/bin, can’t be mapped to anything. They stay as they were.
  • Logins stay where they are. Sign in to Claude Code on the Mac with /login.

Move it with hopsesh

hopsesh is a free, open-source command-line tool, terminal UI and app for macOS and Windows that moves Claude Code and Codex sessions between your computers over SSH, including between Windows and macOS or Linux. On the Mac:

hopsesh hosts allow win-pc     # a Windows PC with OpenSSH Server, found in ~/.ssh/config or Tailscale
hopsesh trust win-pc
hopsesh plan win-pc:"fix flaky tests"
hopsesh pull win-pc:"fix flaky tests"

On Windows, the hopsesh app (or hopsesh in PowerShell) does the same from the other side; it says “this PC” where the Mac app says “this Mac”.

The plan shows every path it will rewrite before anything is written. hopsesh rewrites paths in one pass, so ids, signatures and encrypted content are never touched; it handles the JSON-escaped Windows paths and converts separators between Windows and macOS or Linux. Paths it can’t map are left as they are and listed in the plan. It also:

  • finds the repository on the Mac by its git remote or clones it, and brings the code to the session’s commit, fetching it from the Windows PC if it was never pushed;
  • installs the transcript under the project folder name Claude Code expects on the Mac and prints the claude --resume command;
  • leaves the Windows copy blocked until you move the session back, and hopsesh pull <id> with no computer name brings it back the other way.

A note on Windows: hopsesh’s Windows app and installer are tested in CI on Windows Server 2025, and the installer isn’t code-signed yet, so SmartScreen asks you to confirm it, and on Windows 11 PCs with Smart App Control turned on it won’t run until it is signed. Install it with Scoop (scoop install hopsesh from the roeehrl bucket) or the PowerShell install script. Reading sessions on the Windows PC from a Mac needs only OpenSSH there, not hopsesh.

hopsesh is alpha software, and an independent project, not affiliated with Anthropic or OpenAI. More: move a Claude Code session to another computer.

Between Windows and macOS

Where are Claude Code sessions on Windows?

In %USERPROFILE%\.claude\projects\<project>\<session-id>.jsonl. A session started in C:\Users\alice\src\webapp is in the folder C--Users-alice-src-webapp: the colon and each backslash become dashes.

Can I just copy a Windows session to my Mac?

Claude Code will find it once it is in the Mac’s project folder, but every path inside is still a JSON-escaped Windows path such as C:\\Users\\alice, so Claude starts out in a folder that doesn’t exist. The paths, and their separators, need rewriting.

Does hopsesh convert paths between Windows and macOS?

Yes. It rewrites paths in one pass, including JSON-escaped Windows paths, converts separators between Windows and macOS or Linux, leaves ids and signed reasoning untouched, and lists any path it couldn’t map in the plan.

What does the Windows PC need?

OpenSSH Server, so hopsesh on the Mac can read its sessions. hopsesh on Windows is needed only to work from that side; its installer isn’t code-signed yet, so SmartScreen asks you to confirm it.

Use the method

Try it with hopsesh

Open-source CLI and desktop app: move a Claude Code or Codex session to another computer, into the other agent, or to the cloud, with undo built in.

See everything hopsesh does →
Install the CLI Terminal macOS and Linux · Command line and terminal UI brew install roeehrl/tap/hopsesh Without Homebrew: curl -fsSL https://raw.githubusercontent.com/roeehrl/hopsesh/main/scripts/install.sh | sh, which checks the download against the release’s checksums and signature.
Install the CLI Terminal Windows, in PowerShell · Command line and terminal UI irm https://raw.githubusercontent.com/roeehrl/hopsesh/main/scripts/install.ps1 | iex Same checks as the macOS and Linux script. The Windows app installs this command as well.
hopsesh for Mac .dmg macOS app · macOS 13 or later · Apple silicon and Intel Download Signed and notarized by BlueGuru LLC. Updates itself from Settings → Updates.
hopsesh for Windows .exe Windows app · Windows 10 or 11 · x64 Download Not code-signed yet: at SmartScreen, click More info, then Run anyway. Smart App Control, if on, blocks it.
More ways to install
  • Installer for Arm64 Windows 10 or 11 on Arm
  • Portable .zip x64 or Arm64, no install, on the release page
  • Command line with Scoop from the roeehrl bucket, without the app scoop bucket add roeehrl https://github.com/roeehrl/scoop-bucket; scoop install hopsesh
  • Command line only in PowerShell, without the app irm https://raw.githubusercontent.com/roeehrl/hopsesh/main/scripts/install.ps1 | iex
Linux packages and all files GitHub Latest release · .deb, .rpm and .apk for amd64 and arm64, a portable Windows app .zip, plus archives Open on GitHub Release notes, checksums and every build of the current version. Source on GitHub GitHub Apache-2.0 · Go 1.26 or later to build Open on GitHub From source: go install github.com/roeehrl/hopsesh/cmd/hopsesh@latest