Skip to content
How to Turn an Old Mac into a Dedicated Claude Code Server – Claude Code on Spare Mac
SELF-HOSTING

How to Turn an Old Mac into a Dedicated Claude Code Server – Claude Code on Spare Mac

A spare Mac mini or an aging MacBook gathering dust is, in practical terms, a small always-on Unix box. That happens to be exactly what’s needed to run Claude Code as a persistent, remotely accessible coding agent — something you can dispatch tasks to from a laptop, phone terminal app, or another machine on the network, without keeping your primary computer tethered to a terminal session. This is a walkthrough of what it actually takes, including the parts that trip people up: sleep settings, disk encryption, and what happens when your SSH connection drops mid-task.

What hardware and OS do you need for a Claude Code server?

The official baseline for Claude Code is modest: macOS 13.0 (Ventura) or later, at least 4GB of RAM, with 8GB or more recommended once you’re working in larger repositories. It runs on both Apple Silicon and Intel hardware, and some install guides cite a floor as low as macOS 10.15 Catalina, though targeting Ventura is the safer bet.

That requirement determines which old Macs are even eligible. Ventura supports MacBook models from 2017 onward, MacBook Air from 2018, Mac mini from 2018, iMac from 2017, and any Mac Studio or iMac Pro, among others. Apple’s stated minimum is 8GB of RAM, but for Intel machines specifically, 16GB or more is recommended to avoid swap-related slowdowns — an important distinction if the “old Mac” in question is a 2018 Intel mini rather than an Apple Silicon model.

What Claude account do you need?

Claude Code doesn’t work with a free Claude.ai account. A paid Anthropic plan is required — Claude Pro at $20/month ($17/month billed annually), Claude Max at $100 or $200/month for higher usage ceilings, or metered API billing through the Anthropic Console. For a dedicated server running occasional tasks, Pro is the reasonable starting point; heavier, parallel-agent workloads (discussed below) are where Max or API billing become relevant.

It’s also worth knowing what you’re paying for in terms of context. Claude Code defaults to Sonnet, with the option to switch to Opus for harder reasoning tasks or Haiku for lightweight ones, and context windows scale from 200,000 tokens on subscription plans up to 1 million tokens for Opus via the API.

How do you set up headless access on a Mac?

With the software requirements sorted, the next step is making the Mac reachable without a monitor attached. Enable SSH access under System Settings → General → Sharing → Remote Login, or from the terminal itself with sudo systemsetup -setremotelogin onthe same command with -getremotelogin confirms the current status.

This is also where the single biggest gotcha in this whole project shows up. FileVault, Apple’s disk encryption, ships enabled by default on all new Apple Silicon Macs, and it requires a password entered at boot to decrypt the disk — which blocks auto-login entirely. If the Mac loses power or reboots for any reason, it will sit at a password prompt indefinitely, unreachable over the network, until someone walks over and types the password on a physical keyboard. That defeats the entire purpose of a headless server. Anyone building this setup needs to decide upfront whether they’re comfortable disabling FileVault on this particular machine (acceptable for a low-stakes dev box, less so for anything holding sensitive data) or accepting that reboots require in-person intervention.

How do you stop an old Mac from going to sleep?

An old Mac configured as a server needs to stay awake and reachable at all times, which is not the default behavior for consumer hardware. The fix is a specific pmset configuration:

sudo pmset -a sleep 0 displaysleep 0 disksleep 0 womp 1 tcpkeepalive 1 powernap 0 sudo systemsetup -setcomputersleep Never

This combination, run together, is described as an “all-in-one headless server power profile”, and it’s worth pairing with caffeinate -dimsu running in the background as an additional wake assertion. One caveat documented on M4 Mac mini hardware: caffeinate can report that it’s holding a valid assertion while the machine sleeps anyway, so the Energy settings and pmset configuration should be treated as the primary fix, not caffeinate alone.

Why does Claude Code stop running after you disconnect?

This is the part that catches almost everyone the first time: you SSH in, start Claude Code, close your laptop lid or lose wifi, and reconnect later to find the process gone. The cause is straightforward — closing an SSH session sends a SIGHUP signal to every process in that terminal’s process group, and Claude Code, like any foreground process, exits on SIGHUP.

The standard fix is tmux, a terminal multiplexer that keeps processes running on the server independent of whether a client is attached. Start a session with tmux new -s claude, run Claude Code inside it, then detach with Ctrl+B followed by D. The session — and Claude Code inside it — keeps running on the Mac regardless of what happens to your SSH connection. Reattach later from any device with tmux attach -t claude.

If your network connection itself is unreliable (switching between wifi and cellular, high-latency links), plain SSH will still drop the underlying connection even if tmux preserves the session state on reconnect. Mosh (Mobile Shell) is built to survive exactly this — the original mosh research demonstrated a drop in average response time from 16.8 seconds to 0.33 seconds on a link with 29% packet loss, a roughly 50x difference over standard SSH.

How do you reach the Mac from outside your home network?

Port-forwarding your router to expose SSH to the internet is the traditional approach, and also the one most likely to get a machine scanned and probed within hours. Tailscale’s free Personal plan supports up to 6 users and unlimited personal devices (the earlier 100-device cap was removed), building a private WireGuard-based mesh network with no forwarded ports required. Install it on the Mac and on whatever device you’re connecting from, and the Mac becomes reachable by its Tailscale address from anywhere, encrypted end to end.

How much RAM does Claude Code actually need for parallel agents?

Claude Code’s actual footprint depends heavily on how it’s used. Running a single foreground session is light. Running multiple parallel subagents — Claude Code’s “Dynamic Workflows” pattern — is not. One community report found that an 8GB VM had Claude Code OOM-killed under heavy orchestration load, taking the entire tmux session down with it; the same source recommends 16GB as a baseline for a Claude Code server and 32GB or more if you plan to run many subagents concurrently. This is a reasonable argument for retiring a 2018 8GB Mac mini from this role and instead using a 16GB-or-better model if one is available.

This RAM guidance also narrows the pool of “old Macs” that make sense for the job more than the OS compatibility list alone suggests. Ventura’s official support list includes 2018 Mac minis and 2017 iMacs, but those are Intel models that Apple itself flags as needing 16GB to avoid swap slowdowns even for ordinary use — before factoring in Claude Code’s own 16GB baseline and the OOM risk under parallel-agent workloads. In effect, the two sets of minimums stack: an Intel Mac at Apple’s bare 8GB minimum is likely to struggle at the OS level and the Claude Code level simultaneously, which makes an Apple Silicon machine (or an Intel model already upgraded to 16GB+) the more realistic candidate for this project despite both technically appearing on the same “supported” list.

Is it safe to run Claude Code unattended on a headless Mac?

Running Claude Code unattended on a headless server often means running it with reduced permission prompts, since there’s no one at a keyboard to approve every action. Anthropic’s own guidance is explicit about the risk here: the company recommends containerized usage and ships reference devcontainer configurations with built-in firewall rules for exactly this scenario. An Anthropic Safeguards researcher who ran the --dangerously-skip-permissions flag across 16 parallel agents summarized the lesson bluntly: “Run this in a container, not your actual machine.” That warning is not hypothetical — a documented December 2025 incident involved an unattended agent generating a destructive rm -rf command that expanded to wipe a user’s entire home directory, including Keychain data and application files.

The practical takeaway for anyone building this setup: treat the old Mac as expendable relative to its data. Run Claude Code inside a container or a dedicated non-admin user account, keep backups of anything on that machine you’d miss, and avoid skip-permissions flags unless the working directory is genuinely disposable.

Putting it together

The full checklist, in order: confirm the Mac supports Ventura and has adequate RAM, subscribe to Claude Pro or Max, enable Remote Login, disable FileVault auto-lock or accept the reboot tradeoff, apply the pmset sleep-prevention profile, install Tailscale for remote access, and run Claude Code inside tmux (with mosh layered on top if your network is unreliable). None of these steps is individually difficult, but skipping any one of them — particularly the sleep settings or tmux — is why headless Claude Code setups tend to work for an hour and then quietly vanish.

FAQ

Can I run Claude Code on an old Mac with only 8GB of RAM? Technically yes for light, single-session use, but community reports document Claude Code getting OOM-killed on 8GB under heavy parallel-agent orchestration, and Apple itself recommends 16GB for Intel Macs to avoid swap slowdowns. 16GB is the more realistic baseline for a dedicated server.

Why does FileVault break headless Mac setups? FileVault requires a password typed at boot to decrypt the disk, which blocks auto-login. If the Mac reboots or loses power, it sits at a password prompt until someone enters it in person — defeating the purpose of a remote, unattended server.

Why does Claude Code quit when I close my laptop or lose SSH connection? Closing an SSH session sends a SIGHUP signal to every process in that terminal’s process group, and Claude Code exits on SIGHUP like any foreground process. Running it inside tmux keeps it alive on the server independent of the client connection.

Do I need to port-forward my router to access the Mac remotely? No. Tailscale creates a private WireGuard-based mesh network without forwarded ports, and its free Personal plan supports up to 6 users and unlimited personal devices, which is generally safer than exposing SSH directly to the internet.

Is it safe to run Claude Code with --dangerously-skip-permissions on a headless Mac? Anthropic recommends against it outside a container. A documented December 2025 incident involved an unattended agent generating a destructive rm -rf command that wiped a user’s home directory, so unattended use should happen in a container or dedicated non-admin account with backups in place.