Codeman logocodeman GitHub →

Run Claude Code on a VPS or Mac mini and use it from anywhere

Updated 2026-10-10

On this pageDo you need your own server?Choosing the box: VPS, home server or Mac miniInstall Claude Code on a remote serverLog in on a headless machineCan I use my Claude subscription on a server?Keep sessions running with tmuxAccess Claude Code remotely: SSH keys and TailscaleMac mini setup: no sleep, and start at bootHow Codeman handles it

Yes, you can install Claude Code on a VPS, a home Linux server or a Mac mini and use it from any computer or phone: run it inside tmux on that machine and connect over SSH or a private network such as Tailscale. This guide covers each step as of October 2026: the machine, a login without a browser, sessions that survive, access without an open port, and a Mac mini that stays awake.

Do you need your own server?

Not always. Anthropic suggests its cloud sessions at claude.ai/code, which run on Anthropic-managed infrastructure by default, "when you want to start a task without any local setup" (Remote Control vs cloud sessions). Remote Control drives a session on your own machine from claude.ai/code or the Claude app, so "your computer has to stay on and the claude process has to keep running"; it needs a Pro, Max, Team or Enterprise login. The desktop app's SSH sessions run Claude Code on a remote Linux or macOS machine. A box of your own fits when the work needs your files and toolchain and must continue while your laptop is closed.

Choosing the box: VPS, home server or Mac mini

Anthropic's system requirements are macOS 13.0+, Ubuntu 20.04+, Debian 10+ or Alpine Linux 3.19+ (Windows is supported too), 4 GB+ RAM, an x64 or ARM64 processor and an internet connection. The list also names a location, Anthropic supported countries, worth checking before you pick a VPS region. Budget for what Claude runs as well: builds, tests and every parallel session.

VPS Home Linux box Mac mini
Stays on through The provider's power and network Your power and internet Your power and internet; turn off sleep
Reaching it Public address: SSH keys first Behind your router: a private network Same as a home box
Fits when You want a clean Linux machine away from home You have spare hardware The work needs macOS

Install Claude Code on a remote server

Use a regular account, not root: Claude Code refuses --dangerously-skip-permissions under root or sudo (permission modes), and an ordinary account limits what an agent can change. Then run the recommended native installer, which updates itself in the background (signed apt, dnf and apk repositories exist too):

curl -fsSL https://claude.ai/install.sh | bash
claude --version   # a working install prints a version number
claude doctor      # install and settings diagnostics

Log in on a headless machine

You need a Pro, Max, Team, Enterprise or Console account (setup). Run claude on the server, press c at the login prompt to copy the sign-in URL, and open it on your own computer. That browser cannot reach Claude Code's local callback server, so after you sign in it shows a login code to paste at the Paste code here if prompted prompt (troubleshooting); if pasting does nothing, claude auth login reads the code from standard input. On Linux the login lands in ~/.claude/.credentials.json (mode 0600); on a Mac over SSH, a locked Keychain can reject the write, and Claude Code then uses that file (credential management).

To skip interactive sign-in on the server, run claude setup-token on a machine with a browser: it prints a one-year OAuth token for your Claude subscription without saving it, and you set that on the server as CLAUDE_CODE_OAUTH_TOKEN. The token can only make model requests, so it cannot start Remote Control sessions or fetch claude.ai connectors. A normal login expires too; renew it when Claude Code warns Your login expires in 3 days · run /login to renew, since background and Remote Control sessions stop making progress once it lapses (renew an expiring login).

Can I use my Claude subscription on a server?

Anthropic's legal and compliance page says OAuth login is "designed to support ordinary use of Claude Code and other native Anthropic applications", and that its rules do not prevent "an end user from signing in to the unmodified Claude Code binary with their own Claude subscription, including where a platform hosts Claude Code". They rule out third-party developers offering claude.ai login in their own apps, routing requests through Free, Pro or Max credentials on behalf of their users, or collecting claude.ai credentials. If other people use the box, two more lines apply: advertised Pro and Max limits "assume ordinary, individual usage", and the Consumer Terms, which cover Free, Pro and Max, forbid making your account "available to anyone else".

Keep sessions running with tmux

Anthropic's Remote Control docs put it plainly: "If you run claude from a terminal on a remote machine, start it inside tmux or screen to keep the session running after you disconnect from SSH" (limitations).

ssh you@server
tmux new -A -s main    # create session "main", or attach if it exists
claude                 # Ctrl-b then d detaches; Claude keeps working

Later, from any computer or phone: ssh -t you@server tmux new -A -s main (tmux(1)). Anthropic lists three ~/.tmux.conf lines that make Shift+Enter insert a newline and let notifications reach your outer terminal (terminal config):

set -g allow-passthrough on
set -s extended-keys on
set -as terminal-features 'xterm*:extkeys'

Claude Code also has background sessions: claude --bg "task" hands work to a supervisor process that keeps it going after you close your shell, and claude agents lists them (agent view, a research preview). A reboot ends both kinds; claude --continue in the same directory reopens the latest conversation (sessions). Sessions are stored per machine, in ~/.claude/projects/, so to use the same sessions on multiple computers, run Claude on one server and connect to it from each.

Access Claude Code remotely: SSH keys and Tailscale

On a VPS the SSH port faces the internet, so make it key-only first. Ubuntu's OpenSSH guide covers the key setup and the drop-in directory used here:

# on your own computer
ssh-keygen -t ed25519
ssh-copy-id you@server

# on the server, once a key login works
printf 'PasswordAuthentication no\nKbdInteractiveAuthentication no\n' |
  sudo tee /etc/ssh/sshd_config.d/10-keys-only.conf
sudo sshd -t && sudo systemctl restart ssh.service   # Ubuntu's unit name

Both settings default to yes (sshd_config(5)); because OpenSSH keeps the first value it reads, the drop-in overrides Ubuntu's main file. Keep your current session open until a fresh key login works.

A private network lets you keep SSH off the public internet. Tailscale connects devices "without requiring port forwarding", so it also reaches a home box behind a router. Install it on the server and on each device (Linux install):

curl -fsSL https://tailscale.com/install.sh | sh
sudo tailscale up    # prints a URL; open it to sign the machine in to your tailnet

MagicDNS, on by default for new tailnets, gives each device a name, so ssh you@server works from any device on your tailnet. On a trusted server, disable key expiry: node keys expire after 180 days by default, and then connections to the device stop.

Never an open port without authentication. A web terminal, browser IDE or agent dashboard on the box is a shell on the box. Bind it to 127.0.0.1 and reach it through ssh -L 8080:localhost:8080 you@server or Tailscale Serve, which shares it with your tailnet only (Funnel is the variant that publishes to the internet). For phone clients and mosh, see Use Claude Code from your phone.

Mac mini setup: no sleep, and start at boot

From Apple's documentation for macOS 26 and later:

In Terminal, pmset sets the system sleep timer and automatic restart (man page); caffeinate instead holds a sleep assertion only while one command runs:

sudo pmset -a sleep 0          # system sleep timer: 0 disables it
sudo pmset -a autorestart 1    # automatic restart on power loss
caffeinate -i claude           # or, inside tmux: no idle sleep while claude runs

For start-up, a LaunchAgent in ~/Library/LaunchAgents "executes only while that user is logged in", while a LaunchDaemon in /Library/LaunchDaemons is loaded at system startup (Apple, folders). After an unattended restart, two details decide what comes back:

How Codeman handles it

Codeman is a self-hosted dashboard you install on the box itself. It runs Claude Code, Codex, OpenCode and other agent CLIs in tmux sessions there and streams the real terminals to any browser, so closing the browser or losing the connection leaves the agents running. Install it as a regular user:

curl -fsSL https://getcodeman.com/install | bash

After one confirmation for missing prerequisites such as Node.js and tmux, the installer asks how the dashboard should be reachable:

It ends on the URL (with a QR code for your phone on the Tailscale and network routes) and offers to install a background service; codeman service install does that later (a systemd user unit on Linux, a LaunchAgent on macOS), with loginctl enable-linger $USER on Linux to keep it running while you are logged out (Running As A Service). With a password and the Cloudflare tunnel instead, the dashboard shows a single-use QR login code that rotates every 60 seconds (Remote Access).

Limits worth knowing: