Repurposing a spare Mac as a dedicated host for Claude Code — Anthropic’s AI-powered command-line coding assistant — has become a popular workflow among developers who want an always-on machine handling long-running agentic tasks. But as threads in the Apple Support Community make clear, the setup is far from plug-and-play. Users report a consistent set of headaches: SSH connections that silently fail, Full Disk Access prompts that never appear, background processes killed by macOS power management, and Claude Code sessions that terminate the moment the remote user logs out.
This is a widespread, actively discussed problem. If you’re trying to turn an old MacBook or Mac mini into a remote-controlled coding workstation and hitting walls, this guide walks through the causes and the fixes that actually stick on modern macOS releases (Sonoma, Sequoia, and Tahoe).
What Causes This Issue
The root of the trouble is that macOS is designed as a personal, interactive operating system — not a headless server. Several security and power-management layers actively work against the kind of unattended remote automation Claude Code needs. The most common causes reported by users in the Apple Support Community include:
- Remote Login (SSH) is disabled by default, and enabling it via System Settings often doesn’t grant the necessary permissions to child processes.
- macOS Transparency, Consent, and Control (TCC) blocks Claude Code from accessing folders like Documents, Desktop, or Downloads unless the parent terminal has Full Disk Access.
- The Mac sleeps, disconnects Wi-Fi, or suspends background processes when the lid closes or no user is logged in at the console.
- Login shells launched over SSH don’t inherit the same environment variables (PATH, API keys) as an interactive Terminal window, so the claude CLI can’t find Node.js or its credentials.
- Apple Silicon Macs enforce stricter code-signing rules that can block Homebrew-installed binaries from running under launchd without explicit permissions.
Step-by-Step Fixes
No single accepted solution has emerged in the community thread, but the following sequence resolves the vast majority of setup failures reported by users. Work through it in order.
- Enable Remote Login properly. Open System Settings, go to General, then Sharing, and toggle on Remote Login. Click the info icon and set access to “All users” or add specific accounts. Verify by running ssh user@mac-hostname.local from another device on the same network. If it fails, confirm the Mac’s hostname in Sharing and try the IP address instead.
- Grant Full Disk Access to the SSH daemon and your shell. This is the single most-missed step. Go to System Settings, Privacy & Security, Full Disk Access. Click the plus button and add /usr/sbin/sshd-keygen-wrapper (use Shift+Cmd+G in the file picker to type the path). Also add Terminal, iTerm, and — critically — the binary at /bin/zsh or /bin/bash. Without this, Claude Code will silently fail to read or write project files.
- Install Claude Code in a shell-agnostic location. Install Node.js via Homebrew (brew install node), then run npm install -g @anthropic-ai/claude-code. Confirm the binary lands in a globally accessible path such as /opt/homebrew/bin. Add that path to a login-shell config file like ~/.zprofile — not just ~/.zshrc — so SSH sessions pick it up.
- Persist your Anthropic API key. Export ANTHROPIC_API_KEY in ~/.zprofile, or better, store it in the macOS Keychain and retrieve it via a small wrapper script. SSH sessions do not load GUI keychain items automatically, so relying on Keychain Access alone will break unattended runs.
- Prevent sleep and lid-close suspension. Open Terminal and run sudo pmset -a disablesleep 1 to prevent clamshell sleep on laptops. Alternatively, in System Settings under Displays and Battery, set the machine to never sleep when plugged in and enable “Prevent automatic sleeping on power adapter when the display is off.”
- Enable automatic login and Wake for Network Access. Under Users & Groups, set automatic login for the Claude Code account (this requires FileVault to be off, or a stored unlock key). In Energy or Battery settings, enable Wake for Network Access so the Mac responds to SSH after idle periods.
- Test end-to-end. From your primary machine, SSH in and run claude –version, then start a session in a project directory. Confirm it can read files, write changes, and run git commands without permission prompts.
Additional Solutions
If the basics work but reliability is still shaky, layer on these refinements. Users in the Apple Support Community have highlighted the first two as particularly helpful for long-running sessions.
- Run Claude Code inside tmux or screen. Launching tmux new -s claude before starting Claude Code lets you disconnect from SSH without killing the session. Reattach later with tmux attach -t claude. This solves the “session dies when I close my laptop” complaint entirely.
- Set up Tailscale or a similar mesh VPN. Exposing SSH to the open internet is risky. A private mesh network gives you a stable hostname reachable from anywhere without port forwarding, dynamic DNS, or firewall gymnastics.
- Use SSH key authentication only. Generate a key with ssh-keygen -t ed25519, copy the public key to ~/.ssh/authorized_keys on the spare Mac, and disable password auth by editing /etc/ssh/sshd_config. Restart Remote Login afterward.
- Create a launchd agent if you want Claude Code or a wrapper script to start automatically at boot. Place a plist in ~/Library/LaunchAgents and load it with launchctl. Remember that launchd processes don’t inherit shell environment — set variables explicitly in the plist.
- Point Claude Code at a dedicated workspace outside iCloud Drive. Files inside iCloud-synced folders can be evicted from local storage, causing unpredictable read failures during long agentic runs.
- Monitor with a lightweight dashboard. Tools like btop or a simple cron job that pings a healthcheck URL will alert you when the machine goes offline instead of discovering it hours later.
When to Contact Apple Support
Most Claude Code setup problems are configuration issues, not hardware faults. Contact Apple Support only if you observe symptoms unrelated to the software layer: kernel panics on wake, Ethernet or Wi-Fi hardware that drops repeatedly under low load, a Mac that refuses to boot to a login window, or persistent T2/Secure Enclave errors that block Remote Login from being enabled at all. If System Integrity Protection or MDM policies are blocking changes (common on ex-corporate machines), Apple Support can help verify the device is properly deregistered from Apple Business Manager.
FAQ
Does Claude Code work on Intel Macs? Yes. Node.js runs fine on Intel, and the CLI is architecture-agnostic. Older Intel MacBooks make excellent dedicated hosts, though battery health and thermals should be checked.
Can I run Claude Code without keeping a user logged in? Yes, via SSH once Remote Login is enabled — but the account still needs to exist and have Full Disk Access granted. Automatic login at boot is the most reliable path.
Why does Claude Code work in Terminal but fail over SSH? Almost always a PATH or permissions problem. Move environment setup to ~/.zprofile and add /bin/zsh to Full Disk Access.
Will closing my MacBook’s lid kill the session? Only if sleep isn’t disabled. Run pmset to prevent it, or use an external display and power adapter with clamshell mode configured to stay awake.
Is this setup safe to expose to the internet? Not directly. Use key-only SSH plus a mesh VPN. Never open port 22 to the public without additional hardening.







































