It can be quite useful to have Claude Code running on a Raspberry Pi. For instance:

  1. it can serve as an always-on low-power dev machine that you can SSH into from anywhere.
  2. It could be a dedicated coding box separate from the main machine.
  3. If you have, like I do, several self-hosted services or you run your own home lab, it’s great to have the Claude Code running on the same machine so that it can iterate on scripts, backup using rsync and debug things.
  4. You could also run a bunch of cron jobs setup via Claude Code.

But getting Claude Code running on Raspberry Pi in headless mode is quite painful, or is it?

When I seached online, I found tutorials (for Mac) that basically said grab the OAuth key from the Mac keychain and put that into the config. It works. But for a day or two. Here is a better way:

Run Claude Code on a Headless Device (Raspberry pi)

This is the shortest tutorial I could possibly write.

  1. On your main laptop run the following Claude command. claude setup-token. This gives you an OAuth key claude_code
  2. SSH into the Raspberry Pi and install Claude with this command curl -fsSL https://claude.ai/install.sh | bash
  3. We’re going to add the token into memory by running this command: echo 'export CLAUDE_CODE_OAUTH_TOKEN=<token>' >> ~/.bashrc – substitute your token here
  4. Run nano ~/.claude.json and add in "hasCompletedOnboarding" and set it to true image-20260404212725282
  5. Start Claude Code claude
  6. That’s it. You’re done.