Updating ccam
On this page
ccam update downloads a ccam release from GitHub, checks it against the release's checksums.txt and replaces the running binary in one rename. Use it when you installed ccam with the install script or from an archive. The dashboard also asks GitHub for the latest release each time it opens and offers it with U, which runs the same steps after asking. Other commands never contact GitHub, so they work the same offline.
Usage
Installing the latest release
ccam updateccam update asks GitHub for the latest release, downloads it, checks it and replaces ccam:
$ ccam update
→ downloading https://github.com/jhyunwoo/ccam/releases/download/v0.5.0/ccam_linux_amd64.tar.gz
✓ Updated ccam 0.4.0 → 0.5.0 (/home/you/.local/bin/ccam)When no newer release exists, ccam prints ccam 0.4.0 is up to date. and changes nothing.
Checking for a newer release
ccam update --check--check only says whether a newer release exists, and downloads nothing:
$ ccam update --check
ccam 0.5.0 is available (you have 0.4.0). Run `ccam update`.Installing a given release
ccam update --version v0.3.0--version installs the release you name, newer or older than the one you have, so it is also how you roll back. The tag must look like vMAJOR.MINOR.PATCH, with an optional pre-release or build suffix; the leading v may be left out. Anything else fails, for example --version takes a release tag such as v0.3.0, not "1.2". If it names the version you already have, ccam prints ccam 0.4.0 is already installed. --check and --version cannot be used together.
Previewing an update
ccam --dry-run updateWith --dry-run, ccam looks up the latest tag (unless --version names one) and runs the same checks on the binary, then prints what it would download, verify and replace, without downloading:
$ ccam --dry-run update
Would update ccam 0.4.0 → 0.5.0:
download https://github.com/jhyunwoo/ccam/releases/download/v0.5.0/ccam_linux_amd64.tar.gz
verify with https://github.com/jhyunwoo/ccam/releases/download/v0.5.0/checksums.txt
replace /home/you/.local/bin/ccamHow it works
ccam checks the download before it touches the installed binary, and replaces the binary in one rename. None of this code runs when you start Claude Code.
- ccam finds the running binary and resolves symbolic links to its real path. That real path is what gets replaced.
- Without
--version, ccam requests<releases>/latestwithout following the redirect, and reads the tag from theLocationheader (…/tag/v0.5.0). This uses the releases page instead of the GitHub API, so the API's limit of 60 requests an hour does not apply. The lookup times out after 10 seconds. - ccam checks the tag against a strict pattern. A tag ends up in download URLs and in a printed shell command, so nothing with
/,%, spaces or shell characters gets through. ccam then compares it with the running version; a pre-release sorts before its release. - ccam decides whether it may replace the binary at all (see below).
- ccam downloads
ccam_<os>_<arch>.tar.gz(on Windowsccam_windows_<arch>.zip) andchecksums.txtat the same time, with 2 minutes for both. Each download is capped at 256 MB. - The archive's SHA-256 must match its line in
checksums.txtbefore anything else happens. A missing line or a different checksum stops the update withnothing was changed. - ccam reads the archive and takes the first regular file named
ccam(ccam.exefrom the Windows zip). Directories, links and other entries are ignored, and the binary is capped at 256 MB too. - ccam writes the new binary to a temporary file
.ccam.tmp*next to the binary, with the old file's permission bits, flushed to disk and renamed over the old one.
The environment variable CCAM_RELEASES_URL replaces https://github.com/jhyunwoo/ccam/releases, for a mirror or for tests. It must be laid out the same way: <url>/latest redirects to <url>/tag/<tag>, and assets are at <url>/download/<tag>/<asset>.
The whole pipeline, from tag lookup to the rename:
The archive and checksums.txt are downloaded in parallel, and nothing is written until the checksum matches. The rename is atomic, so a crash or a full disk leaves either the old binary or the new one, never half of one. Shortcut commands such as ~/.local/bin/ccwork are symlinks to the ccam binary, so they run the new version without any change.
On Windows a running program's file cannot be replaced or deleted, only renamed. ccam writes the new binary to ccam.exe.new, renames the running ccam.exe to ccam.exe.old, and renames the new file to ccam.exe. If the last step fails, the old binary is renamed back. The next update deletes the ccam.exe.old files it can; while a session is still running from an earlier ccam.exe.old, the running binary becomes ccam.exe.old-<time> instead. Shortcuts that are hard links instead of symbolic links (Shortcut commands) are renewed right after, so they also run the new version; that covers hard links of any older version of ccam that ccam created, not only of the binary just replaced.
Package-managed installs
A copy of ccam installed from the .deb belongs to apt, and replacing it behind apt's back would leave the package database out of sync with the file. Before downloading, ccam checks who owns the binary:
- A binary in
/usr/bin,/bin,/usr/sbinor/sbincounts as package-managed. - Elsewhere, if
dpkgis installed anddpkg -S <path>succeeds, it also counts as package-managed. - Otherwise ccam creates and removes a temporary
.ccam-update-*file next to the binary to make sure it can write there.
For a package-managed binary ccam stops and prints the apt steps:
$ ccam update
ccam: /usr/bin/ccam was installed by a package, so `ccam update` leaves it alone.
To update the .deb, download ccam_0.5.0_linux_amd64.deb from https://github.com/jhyunwoo/ccam/releases/tag/v0.5.0 and run:
sudo apt install ./ccam_0.5.0_linux_amd64.deb
Or install a copy in ~/.local/bin with the install script:
curl -fsSL https://ccam.dev/install.sh | shOn systems other than Linux, only the install script line is printed: irm https://ccam.dev/install.ps1 | iex on Windows. When the folder is not writable, ccam suggests rerunning the install script, which installs ccam in ~/.local/bin.
Safety and edge cases
- A development build reports its version as
devand has no release to compare with, soccam updateandccam update --checkrefuse it.ccam update --version vX.Y.Zinstalls a release over it. For builds made withgo install, see Install ccam. - A failed download, a missing asset for your platform, or a checksum mismatch leaves the installed binary as it was.
- A release that does not exist fails with
there is no release <tag>. When GitHub refuses with HTTP 403 or 429, ccam says it is probably a rate limit and asks you to try again later. --checkonly reads. It does not check whether the binary is package-managed or writable.--versionwith an older tag is how you roll back.