Copying the ~/.claude folder to a new Mac moves most of the files, and breaks three things. Project folder names are derived from absolute paths, so once your user name changes, sessions and memory are looked up in a different folder. The login lives in the Keychain, not in a file, and its refresh token is single use. And a group of files belongs to that one machine only.
I wrote an open source Rust command-line tool, vibe-transfer, for these problems. The limit first: the current phase 1 moves only Claude Code data, only from macOS to macOS, and only through an encrypted bundle file. Codex support and live transfer over the network come in later phases. Below is what the tool does and why, taken from its own code and docs.
Deciding what moves
The tool puts every path under ~/.claude into a class. You can pick from six categories: sessions, memory, settings, secrets, project-files and cache. With no selection flag it asks on the terminal; without a terminal it takes everything except the cache.
The real work is in the "never moves" list. These items are tied to the machine and are useless or harmful on the target:
- Runtime folders such as
sessions,shell-snapshots,ide,session-env,telemetryanddebug. - Anything starting with
daemon, and.device-keys.json. - Lock files, but only where Claude Code itself writes them. A lock file in user content, such as
skills/x/bun.lock, does move; a comment in the code spells out that distinction. .credentials.json: never moved as a file. Secrets take a separate route.
Known user files travel with the settings: output-styles/, rules/, keybindings.json and the script that the status line in settings.json runs. Anything not on the list counts as cache and is taken only with --include-optional. If settings.json runs a script that does not make it into the bundle, the tool writes a note instead of quietly leaving a broken setting behind.
Path differences: folder names come from absolute paths
According to the Claude Code docs, each project's memory lives under ~/.claude/projects/<project>/memory/. The <project> name is built from the project's absolute path. vibe-transfer reimplements that rule by mirroring Claude Code's JavaScript behavior: every UTF-16 unit outside ASCII letters and digits becomes -. A name longer than 200 units is cut, and a base36 suffix computed with Java's String.hashCode is appended.
The UTF-16 detail looks minor and still changes the result. A single character outside the BMP, such as an emoji, produces two dashes. Code that walked the string character by character would produce one, and the name would not match what Claude Code looks for. A project at /Users/alice/proj on the source carries the name -Users-alice-proj; on the target the name is recomputed for /Users/bob/proj.
Finding the project on the target
Before computing the folder name, the tool has to know where the project lives on the target. It does not move project code, only AI data, so matching goes in this order:
- If the project has a git
originURL, the URL is reduced tohost/owner/repo.git@host:owner/repo.gitand thehttps://form give the same result. Repositories under--rootson the target are scanned; a single match is placed directly, and with several matches you are asked to pick. - A git repository with no match goes to the pending area.
- A project without git that sits under your home folder goes to the same relative path on the target if that folder exists; otherwise it waits.
The tool never creates a project folder on the target. Pending data is listed with vibe-transfer pending, and once you create the folder, link attaches it. The scan does not follow symlinks, skips hidden folders, and skips the Library folder directly under the home folder.
Home folder rewriting is narrow too. /Users/alice becomes /Users/bob only when it is followed by /, a quote, a space or the end of the string; a path like /Users/alice2 stays as it is.
Left alone on purpose: cwd in session logs
Session files (.jsonl) keep the working folder in a cwd field. I did not rewrite them. The decision note in the repository gives the reason: nobody knows whether fields such as hash and requestDigest are affected by a content change. Running the experiment needed real claude -p --resume calls on a real account, so it was not run. The default is CLAUDE_REWRITE_JSONL_CWD=false, which means moved logs keep showing the old path.
Secrets: move, do not copy
Claude Code's refresh token is single use; if the same token is used on two machines, one side gets logged out. So the tool does not copy the login, it moves it:
exportputs theClaude Code-credentialsitem from the Keychain into the encrypted bundle. The item is never written to disk in plaintext.importwrites the item into the target Keychain. If the target is logged in to a different Claude account, it asks which one to keep.- Once Claude Code works on the target, you run
logout-sourceon the source. The command handles only the item of the service and account this export moved. It encrypts the item with your passphrase as a backup, opens the backup to compare the value, and deletes the item only if they match.
The bundle is encrypted with age and a passphrase. By default export generates a random passphrase and shows it once; you are expected to carry the file on a USB drive and send the passphrase over another channel. I pinned the scrypt cost: 2^18 when writing (256 MiB of memory, about a second on a laptop) and at most 2^20 when reading. Age's per-machine calibration could make a bundle written on a busy machine hard to open on a slow one. The upper bound limits the work a crafted bundle can demand.
There is a limit. Session logs, history and settings.json already sit on the source in plaintext and may hold secrets. They travel encrypted inside the bundle but are written on the target as they were on the source. scan looks for them by the prefixes ghp_, github_pat_, xoxb-, xoxp-, sk-ant- and the PEM private key header, and lists only the paths, never the values.
Nothing is deleted on the target, every step can be undone
import, link and rollback delete no file on the target. Every changed or removed file moves under ~/.vibe-transfer/backups/<session>/. rollback also undoes the Keychain write: if the target had no item before, it removes the imported one; otherwise it puts the old one back. The one exception is pending --orphans, which deletes pending files no record owns, without a backup, after you confirm on a terminal.
Commands that change anything wait until Claude Code is closed. File modification times and POSIX modes are kept, and verify checks the placed files again later, exiting with code 1 on any deviation. One security note: a bundle can install hook scripts under ~/.claude along with the settings that run them. Import only bundles you created yourself.
Not verified yet
- Two real Macs: Automated tests run in CI on synthetic data. The manual acceptance checklist in
docs/acceptance.md(Keychain read,--resumecount,/rewind) has not been run on two real machines yet. There is no release binary until it passes. - Login outside the Keychain: According to the Claude Code docs, if the Keychain rejects the write, the login falls back to
~/.claude/.credentials.json. vibe-transfer does not move that file, and the secrets category reads only the Keychain item; if your login lives in that file, you sign in again on the target. - Case differences: A project folder like
.Claude, which differs from.claudeonly in case or Unicode form, is skipped with a note. - Windows: not supported.
For now you install from source: cargo install --locked --git https://github.com/denizbarish/vibe-transfer vt-cli. On the source, run vibe-transfer scan to see what will move and then export; on the target, import, followed by verify and pending. For more on Claude Code, see the post on a tool that learns from coding agent mistakes, and all my open source work is on the projects page.


