Install tokenstat on macOS, Linux, or Windows
Installing takes one line. The reason to do it today rather than the day you get curious is further down, and it is the most important thing on this page.
macOS and Linux
curl -fsSL https://tokenstat.ai/install.sh | bash
Windows
irm https://tokenstat.ai/install.ps1 | iex
That is the whole install. There is no runtime to set up, no package manager to add, and no account to create: tokenstat is a single static binary that reads local files.
What the installer actually does
Piping a script into a shell deserves to be looked at rather than trusted, so here is the full list. It:
- Downloads the matching binary from the GitHub Release for your platform.
- Verifies it against
SHA256SUMSbefore doing anything with it. - Puts it in a user-writable path:
~/.local/binon macOS and Linux,%LOCALAPPDATA%\tokenstaton Windows. - Installs an hourly scan schedule (see below for why, and how to skip it). If you later link a machine to an account, re-running
tokenstat schedule --installadds a second entry that uploads on your plan's interval. - Runs a first scan, so you have numbers immediately.
The scripts are in the repository and are the source of truth for both one-liners. Read them first if you would rather: that is what open source is for.
The user-writable path is not an accident.
tokenstat updatereplaces the binary in place, which it can only do somewhere you own. System prefixes like/usr/local/binare deliberately refused rather than silently used.
Skipping the schedule
If you would rather not have a background scan, opt out at install time:
# macOS / Linux
curl -fsSL https://tokenstat.ai/install.sh | bash -s -- --no-schedule
# Windows
$env:TOKENSTAT_NO_SCHEDULE=1; irm https://tokenstat.ai/install.ps1 | iex
You can install or review the schedule later at any time:
tokenstat schedule # print the entry for your platform, change nothing
tokenstat schedule --install # write and activate it
Without --install it prints what it would do and stops, which is the right default for something that touches your system's scheduler.
Why installing early actually matters
This is the part worth acting on now.
Claude Code deletes its transcripts after 30 days by default. Usage that is never scanned before that happens is gone from your machine for good. No tool can recover it later, including this one, because the file it would have read no longer exists.
So the value of installing is not the report you get today. It is the year of history you will still have next December, versus the thirty days you would otherwise be left with. A scheduled scan exists for exactly this reason: it captures the numbers before your tools clean up after themselves.
To see how much has already gone:
tokenstat doctor
It compares what has been archived against Claude Code's own rollup and tells you plainly what has already been lost.
Keeping it current
tokenstat update --check # is there a newer release?
tokenstat update # install it
update verifies SHA256SUMS from the release, the same check the installer does, and then does something a checksum cannot do for you: it runs the downloaded binary and confirms --version matches the release and --help works before letting it replace the one you are using. A hash proves the bytes are the ones published. It says nothing about whether that build runs on your machine, and finding out the hard way would cost you a working tokenstat.
If the new binary cannot run once it is in place, the previous one is put back automatically. On macOS, a signed binary is never replaced by an unsigned one.
Scheduled scans soft-check for a new release once a day and print a hint rather than acting on their own. To have updates applied for you:
tokenstat update --auto on
tokenstat schedule --install # adds a daily check, spread over 15 minutes
tokenstat update --auto off turns it back off. The check is also skipped entirely when a package manager owns the binary, since replacing it there is not tokenstat's business.
macOS Gatekeeper
Release builds are Developer ID signed and notarized when the repository's signing secrets are configured. If you hit a Gatekeeper warning on a build that is not, clearing quarantine on your local copy is enough:
xattr -cr ~/.local/bin/tokenstat
Do not run
codesign --sign -on a downloaded release binary. Ad-hoc signing strips the Developer ID signature, which leaves you worse off than the warning did.
Other ways in
- GitHub Releases carry builds for macOS (Apple silicon and Intel), Windows, and Linux, if you would rather download and place the binary yourself.
- From source, with a recent stable Rust toolchain:
cargo install --path crates/tokenstat-cli - A Homebrew tap and a Scoop manifest are planned once the release format settles. They are not available yet, and this page will say so until they are.
Removing it again
One line, same as installing:
curl -fsSL https://tokenstat.ai/uninstall.sh | bash
That takes the schedule and the binary and leaves your archive alone. Uninstall tokenstat covers the Windows one-liner, how to delete the data too, and the manual steps if you would rather do it by hand.
Related
- Is tokenstat safe to run? covers what it reads and what never leaves your machine.
- What tokenstat counts, and where the numbers come from covers which files it reads and how confident each count is.
- Uninstall tokenstat is the reverse of this page.
More in Getting started
