Turn a Spare Mac Into a Claude Code
Turn a Spare Mac Into a Dedicated Claude Code Workstation in 2026
Anthropic’s Claude Code moved developer workflow from “ask in browser tab” to “delegate inside real repo,” and that changes what a spare Mac is worth in 2026. An idle Mac mini, old MacBook Pro, or lab machine can now become a dedicated coding workstation for long-running refactors, test repair, dependency upgrades, and documentation cleanup while your daily laptop stays free. The practical setup is less about giving the model magical control over macOS and more about building a safe, repeatable terminal environment where Claude Code can read a project, run approved commands, edit files, and leave an auditable trail.

Key Takeaways
- A spare Mac is useful because Claude Code runs inside a real terminal session with access to your project files and command-line tools.
- The safest pattern is a dedicated macOS user, a dedicated workspace directory, and a project-level CLAUDE.md file that defines allowed commands.
- Claude Code is installed with
npm install -g @anthropic-ai/claude-code, according to Anthropic’s Claude Code setup documentation. - macOS Accessibility, Automation, and Full Disk Access should be granted only when a specific workflow needs them.
- SSH, tmux, logs, and shell scripts are more predictable for remote operation than GUI automation.
Why a Spare Mac Changes Claude Code Setup in 2026
A spare Mac gives Claude Code a contained place to work. That matters because the tool operates close to your source tree: it can inspect files, propose edits, run commands, and use feedback from tests or linters to continue. Running that on your main laptop is convenient, but it also mixes model-driven file changes with your personal shell history, browser sessions, credentials, and half-finished local work.

The machine stays plugged in, connected to the network, and available for long jobs. If a dependency update takes 40 minutes of install, build, test, and retry cycles, your daily Mac is not tied up and your active working tree is not disrupted.
This pattern also creates a clearer trust boundary. The spare Mac can have only the repositories, package managers, SDKs, and test credentials required for development. You can keep production secrets, personal downloads, private SSH keys, and unrelated projects off the machine. That separation becomes more important as coding agents move from short suggestions to multi-step edits.
For more background on why structured context matters for code generation, see our related guide to structured context files for AI code generation. The same principle applies here: the better your machine and repo explain their constraints, the less time you spend correcting avoidable mistakes.
Hardware and Software Requirements in 2026
Start with a Mac that can run your actual project toolchain. Claude Code is only one part of the setup. If your repo needs Xcode, Docker alternatives, Node.js, Python, Swift, Go, or a local database, the spare machine needs enough CPU, memory, and disk to run those tools without stalling.
- macOS: Use a currently supported macOS release for security updates and modern developer tools.
- Node.js: Anthropic’s setup docs specify Node.js 18 or newer for the npm installation path.
- Package manager: npm is required for the official install command. Homebrew is optional but useful for installing developer dependencies.
- Storage: Leave enough free space for repos, dependency caches, build artifacts, logs, and test fixtures.
- Network: Use Ethernet if the Mac will run unattended. Wi-Fi sleep behavior causes confusing failures during long test runs.
- Account access: Claude Code requires authentication with Anthropic. Follow the official prompts after installation.
An Apple Silicon Mac mini is a practical choice because it is quiet, power efficient, and easy to leave connected. An older Intel Mac can still work for many web projects, but native build times and simulator workflows may be slower. The best test is not a synthetic benchmark. Clone your largest repo, run a clean install, run the full test suite, and check whether the machine can complete the job without memory pressure or thermal throttling.

Installing Claude Code on macOS in 2026
Anthropic documents Claude Code as a command-line tool. The official setup flow is short: install the npm package globally, move into your project directory, and run claude. The full setup page is available in Anthropic’s Claude Code documentation.
Note: The following code is an illustrative example and has not been verified against official documentation. Please refer to the official docs for production-ready code.
#!/usr/bin/env bash
set -euo pipefail
# install-claude-code.sh
# Purpose: install Claude Code on a macOS dev machine.
# Requirements: Node.js 18+ and npm installed.
# Production note: pinning tool versions through your team's device-management
# process is safer than ad hoc global installs on shared machines.
echo "Checking Node.js version..."
node --version
echo "Checking npm version..."
npm --version
echo "Installing Claude Code..."
npm install -g @anthropic-ai/claude-code
echo "Verifying Claude Code is on PATH..."
command -v claude
echo "Installed Claude Code version:"
claude --version
# Expected output:
# Checking Node.js version...
# v18.x.x or newer
# Checking npm version...
# 9.x.x or newer
# Installing Claude Code...
# ...
# Verifying Claude Code is on PATH...
# /opt/homebrew/bin/claude or another PATH location
# Installed Claude Code version:
# claude-code version output
Save that script as install-claude-code.sh, then run it from an admin account or from the dedicated dev account you plan to use. If node is missing, install Node.js through your team’s approved path. Many developers use the official Node.js installer or a version manager, but the important requirement for this setup is the version floor stated in the Claude Code docs.
After installation, create or clone a real project. Claude Code works best when launched from the root of a repo because that is where it can read package files, tests, source directories, and your project instructions.
#!/usr/bin/env bash
set -euo pipefail
# start-work-session.sh
# Purpose: start Claude Code from project root on spare Mac.
# Production note: this assumes the repo already exists and that
# the current user has read/write access to it.
PROJECT_DIR="$HOME/Projects/billing-service"
if [ ! -d "$PROJECT_DIR/.git" ]; then
echo "Project repo not found at $PROJECT_DIR" >&2
exit 1
fi
cd "$PROJECT_DIR"
echo "Repo:"
git remote -v | sed -n '1,2p'
echo "Current branch:"
git branch --show-current
echo "Starting Claude Code..."
claude
# Expected output:
# Repo:
# origin [email protected]:company/billing-service.git (fetch)
# origin [email protected]:company/billing-service.git (push)
# Current branch:
# main
# Starting Claude Code...
# Claude Code interactive session starts
Use one repo per task when possible. If you ask the assistant to update the billing service, frontend dashboard, and infrastructure module in the same session, you increase the chance of crossed assumptions. Smaller sessions are easier to review and easier to roll back.
Granting macOS Permissions Without Overexposing the Machine
Claude Code does not need broad macOS GUI permissions for normal repo work. Most useful dev tasks happen through the shell: edit files, run tests, inspect failures, and commit changes after review. Treat Accessibility, Automation, Screen Recording, and Full Disk Access as special permissions for special cases, not as default setup steps.
For terminal-driven coding, a dedicated user account needs normal file access to the workspace directory and permission to run your dev commands. If you use Terminal, iTerm2, or another terminal app to run scripts that control other apps, macOS may prompt for additional permissions. Grant those to the terminal app only when the workflow requires them.
Use a dedicated workspace such as ~/Projects and keep it separate from personal folders. Avoid placing repos on the Desktop or in Downloads. These directories often accumulate unrelated files, and unrelated files create both a privacy risk and prompt noise.
#!/usr/bin/env bash
set -euo pipefail
# prepare-workspace.sh
# Purpose: create a constrained workspace for Claude Code tasks.
# Production note: this script does not configure mobile-device management,
# endpoint protection, or enterprise policy controls.
WORKSPACE="$HOME/Projects"
LOG_DIR="$HOME/ClaudeLogs"
mkdir -p "$WORKSPACE"
mkdir -p "$LOG_DIR"
chmod 700 "$WORKSPACE"
chmod 700 "$LOG_DIR"
cat > "$LOG_DIR/README.txt" << 'EOF'
Claude Code logs directory.
Each task creates a timestamped session log.
EOF
echo "Workspace created at $WORKSPACE"
echo "Log directory created at $LOG_DIR"
# Expected output:
# Workspace created at /Users/claude-agent/Projects
# Log directory created at /Users/claude-agent/ClaudeLogs

Setting Up Shell Automation and CLAUDE.md
The project instruction file is the most important part of a dependable spare-Mac workflow. Claude Code supports project context through CLAUDE.md, as described in Anthropic's memory documentation. Place this file at the repo root and make it specific to the machine, project, and review rules.
Note: The following code is an illustrative example and has not been verified against official documentation. Please refer to the official docs for production-ready code.
# CLAUDE.md
## Project
This repo contains the billing-service API.
## Spare Mac rules
- This machine runs unattended during long test and refactor tasks.
- Keep all generated logs under ~/ClaudeLogs/billing-service/.
- Do not edit files outside this repo.
- Do not read ~/.ssh, ~/Downloads, ~/Desktop, or browser profile directories.
- Ask before installing new packages or changing global configuration.
- Prefer small commits that a human can review.
## Allowed commands
- npm test
- npm run lint
- npm run typecheck
- npm run build
- git status
- git diff
- git log --oneline -n 20
## Commands that require confirmation
- npm install
- npm audit fix
- git push
- database migrations
- deleting files
## Definition of done
- Tests pass.
- Lint passes.
- Type checks pass.
- git diff is summarized before any commit.
This file does two jobs. First, it gives the assistant stable project instructions without forcing you to repeat them in every prompt. Second, it creates a local operating policy that your team can review in code review. If a command is risky, put it in the confirmation list. If a directory is out of bounds, name it directly.
A wrapper script can make every task leave a timestamped audit trail. The script below starts a session from a known repo, captures basic environment details, and opens Claude Code. It avoids logging secrets from the environment, but it still gives you enough context to debug what happened.
Note: The following code is an illustrative example and has not been verified against official documentation. Please refer to the official docs for production-ready code.
#!/usr/bin/env bash
set -euo pipefail
# claude-task.sh
# Purpose: start a logged Claude Code work session for one repo.
# Usage: ./claude-task.sh billing-service
# Production note: avoid printing environment variables because they may
# contain tokens. This script logs repo state only.
REPO_NAME="${1:-}"
if [ -z "$REPO_NAME" ]; then
echo "Usage: $0 " >&2
exit 1
fi
PROJECT_DIR="$HOME/Projects/$REPO_NAME"
LOG_DIR="$HOME/ClaudeLogs/$REPO_NAME"
TIMESTAMP="$(date +%Y%m%d-%H%M%S)"
SESSION_LOG="$LOG_DIR/session-$TIMESTAMP.log"
if [ ! -d "$PROJECT_DIR/.git" ]; then
echo "Missing Git repo: $PROJECT_DIR" >&2
exit 1
fi
mkdir -p "$LOG_DIR"
cd "$PROJECT_DIR"
{
echo "Started: $(date -u +"%Y-%m-%dT%H:%M:%SZ")"
echo "Host: $(hostname)"
echo "Repo: $PROJECT_DIR"
echo "Branch: $(git branch --show-current)"
echo "Commit: $(git rev-parse --short HEAD)"
echo "Status:"
git status --short
echo
echo "Launching Claude Code..."
} | tee "$SESSION_LOG"
claude 2>&1 | tee -a "$SESSION_LOG"
# Expected output:
# Started: 2026-07-18T20:07:00Z
# Host: spare-mac.local
# Repo: /Users/claude-agent/Projects/billing-service
# Branch: main
# Commit: a1b2c3d
# Status:
#
# Launching Claude Code...
The trade-off is that the wrapper adds one more script to maintain. For solo projects, launching claude manually may be enough. For teams, the wrapper pays for itself when someone needs to answer a practical question: which branch, which commit, which machine, and which task produced this diff?
Using SSH and Remote Sessions Instead of Leaving a Laptop Open
The most reliable remote-control pattern for a spare Mac is standard SSH plus a persistent terminal multiplexer. This avoids depending on a graphical remote desktop session and gives you a clean way to reconnect after closing your laptop or switching networks.
Enable Remote Login in macOS System Settings under General, Sharing, Remote Login. Limit access to the dedicated user if the machine is shared. Then connect from your primary Mac with SSH and run the Claude Code session inside tmux so it survives disconnects.
#!/usr/bin/env bash
set -euo pipefail
# remote-claude-session.sh
# Purpose: connect to a spare Mac and attach to a persistent tmux session.
# Usage: ./remote-claude-session.sh [email protected] billing-service
# Production note: use SSH keys protected by passphrases or your organization's
# approved credential flow. Do not hard-code passwords in scripts.
REMOTE_HOST="${1:-}"
REPO_NAME="${2:-}"
if [ -z "$REMOTE_HOST" ] || [ -z "$REPO_NAME" ]; then
echo "Usage: $0 " >&2
exit 1
fi
ssh "$REMOTE_HOST" "tmux new-session -A -s claude-$REPO_NAME 'cd ~/Projects/$REPO_NAME && claude'"
# Expected output:
# Opens or attaches to a tmux session named claude-billing-service.
# If your SSH connection drops, reconnect with the same command.
This setup works well from another Mac, a Linux workstation, or an iPad SSH client. It also keeps your operational model simple. You are not granting a browser tab control over the desktop. You are connecting to a known Unix account, in a known repo, with a session that you can detach, reattach, and terminate.
If you need graphical access for Xcode, Simulator, or browser tests, use macOS Screen Sharing or your organization's approved remote desktop tool for that part of the job. Keep the coding agent's main loop in the terminal, where commands and output are easier to inspect.
Security Best Practices for an AI-Assisted Mac in 2026
Security is the difference between a helpful spare workstation and a risky unattended machine. Start with a dedicated macOS user account that exists only for dev agent work. Avoid using your personal admin account for Claude Code sessions.
#!/usr/bin/env bash
set -euo pipefail
# create-claude-agent-user.sh
# Purpose: create a dedicated macOS user for agent-assisted dev.
# Run from an administrator account.
# Production note: replace the temporary password immediately and follow
# your organization's account-management policy.
AGENT_USER="claude-agent"
FULL_NAME="Claude Agent"
sudo sysadminctl -addUser "$AGENT_USER" -fullName "$FULL_NAME" -password "ChangeThisPasswordImmediately"
echo "Created user: $AGENT_USER"
echo "Now sign in as $AGENT_USER, change the password, and install only required developer tools."
# Expected output:
# sysadminctl user creation messages
# Created user: claude-agent
Do not make the account an administrator unless your workflow truly needs it. Many repo tasks need package installs inside the project, not system-wide changes. If the agent account cannot modify system settings, install kernel extensions, or read another user's home directory, the damage from a bad command is smaller.
Use separate credentials for the spare Mac. A deploy key scoped to one repo is safer than a personal SSH key that can access every repo you own. A test database account is safer than a production database account. If the workflow needs access to external services, prefer short-lived tokens and scoped service accounts.
The macOS firewall should be on. Remote Login should be limited to known users. If the machine lives in an office or lab, require FileVault so a stolen device does not expose source code at rest. These are ordinary controls, but they matter more when the machine is designed to run unattended tasks.
Logging is also a safety feature. Keep command output, diffs, and task notes under a dedicated log directory. Review logs before merging agent-produced changes. A passing test suite is helpful, but it is not a substitute for code review.
Testing Your Setup with Real Commands
After installation, test the setup in layers. Do not start with a large refactor. Confirm the shell, repo permissions, logging, and project commands before you let Claude Code edit anything significant.
Test 1: Check the toolchain
#!/usr/bin/env bash
set -euo pipefail
# test-toolchain.sh
# Purpose: verify that the spare Mac can run the basic dev stack.
# Production note: customize the commands for your repo.
cd "$HOME/Projects/billing-service"
echo "Claude:"
claude --version
echo "Node:"
node --version
echo "npm:"
npm --version
echo "Git:"
git --version
echo "Repo status:"
git status --short
# Expected output:
# Claude:
# claude-code version output
# Node:
# v18.x.x or newer
# npm:
# npm version output
# Git:
# git version output
# Repo status:
# no output if working tree is clean
Test 2: Run safe project checks
Note: The following code is an illustrative example and has not been verified against official documentation. Please refer to the official docs for production-ready code.
#!/usr/bin/env bash
set -euo pipefail
# test-project-checks.sh
# Purpose: confirm that the spare Mac can run normal validation commands.
# Production note: run this before asking Claude Code to make changes.
cd "$HOME/Projects/billing-service"
npm test
npm run lint
npm run typecheck
# Expected output:
# Your project's test runner output
# Your linter output
# Your type checker output
# The script exits with code 0 when all checks pass
Test 3: Ask for a read-only repo summary
cd "$HOME/Projects/billing-service"
claude "Read the repo structure and summarize test commands from package.json. Do not edit files."
# Expected output:
# Claude Code summarizes the repo layout and lists scripts such as test,
# lint, typecheck, or build if they exist in package.json.
Test 4: Ask for a small reversible edit
cd "$HOME/Projects/billing-service"
claude "Find one outdated README instruction related to local setup. Propose a minimal edit, show the diff, and wait for confirmation before changing files."
# Expected output:
# Claude Code identifies a candidate README change and shows the proposed diff.
# It should wait before applying the edit if your instruction is followed.
These tests reveal most setup mistakes. If Claude Code cannot see project files, your workspace permissions are wrong. If tests fail before any agent edits, the spare Mac is missing dependencies or environment configuration. If the assistant ignores your instruction to wait before editing, strengthen your CLAUDE.md rules and keep early tasks small.
Claude Code vs. Other Mac Coding Workflows in 2026
Claude Code is one way to use a spare Mac for dev work. The right comparison is the workflow you would otherwise use: a normal SSH session, a hosted CI runner, or an IDE remote session. Each option has a different cost, review model, and failure mode. Claude Code is a repo-aware tool for edits, test repair, and command-driven dev tasks running on a macOS machine with Node.js 18 or newer.
| Workflow | Best use case | Mac requirement | Source |
|---|---|---|---|
| Claude Code in local terminal | Repo-aware edits, test repair, explanation, and command-driven dev tasks | macOS machine with Node.js 18 or newer and Claude Code npm package | Anthropic setup docs |
| SSH plus shell scripts | Repeatable builds, log collection, deployments, and maintenance commands written by the developer | macOS Remote Login enabled for the target user | Apple Remote Login guide |
| GitHub Actions | Hosted CI jobs triggered by pushes, pull requests, or manual workflow dispatch | No spare Mac required unless you use a self-hosted runner | GitHub Actions docs |
| VS Code Remote SSH | Interactive editing on a remote machine from a local VS Code window | SSH access from VS Code to the spare Mac | VS Code Remote SSH docs |
The trade-off is control versus autonomy. SSH scripts are predictable because they do exactly what you wrote. Claude Code is more flexible because it can inspect errors, edit files, and iterate, but that flexibility requires tighter guardrails and review. Hosted CI is cleaner for final validation, but it is less convenient for exploratory repair work where the assistant needs to read failures, change code, and run checks repeatedly.
A good 2026 setup combines these approaches. Use Claude Code on the spare Mac for local iteration. Use Git for reviewable diffs. Use CI as the final independent check before merge. Use SSH or VS Code Remote SSH when you need direct human control.
Troubleshooting Common Issues
Issue: npm install -g @anthropic-ai/claude-code fails
Cause: Node.js is missing, npm is missing, or the active Node.js version is too old.
Fix: Install Node.js 18 or newer, open a new terminal, and rerun node --version before installing Claude Code again. If your team manages Node versions through a version manager, make sure the shell used over SSH loads the same version as your interactive shell.
Issue: claude installs but the shell cannot find it
Cause: The npm global binary directory is not on PATH for the current shell or SSH session.
Fix: Run npm bin -g where supported by your npm version, inspect the global install location, and add that directory to your shell profile. Then start a new terminal session and run command -v claude.
Issue: Claude Code cannot edit project files
Cause: The repo is owned by another macOS user or was cloned with permissions that block writes.
Fix: Clone the repo while signed in as the dedicated agent user. If you intentionally moved an existing checkout, fix the ownership from an admin account with a narrow path such as sudo chown -R claude-agent:staff /Users/claude-agent/Projects/billing-service.
Issue: Long jobs stop when your laptop disconnects
Cause: The session is tied to a plain SSH connection or the spare Mac is sleeping.
Fix: Run Claude Code inside tmux and configure the spare Mac's power settings so it does not sleep during active work. Prefer Ethernet for unattended runs.
Issue: The assistant makes changes outside the intended scope
Cause: The prompt and project instructions are too broad, or the repo contains multiple unrelated packages.
Fix: Tighten CLAUDE.md, ask for a plan before edits, and require a diff summary before changes. For monorepos, start Claude Code from a specific package directory when possible.
Issue: Tests pass locally but fail in CI
Cause: The spare Mac differs from the CI environment in Node version, environment variables, services, or operating system assumptions.
Fix: Add a setup note to CLAUDE.md, align local versions with CI, and keep the final merge gate in CI. The spare Mac is an iteration machine, not the final source of truth.
Final Thoughts for 2026
Setting up a spare Mac for Claude Code is a practical way to turn idle hardware into a focused dev workstation. The useful pattern is terminal-first: install the official CLI, run it from the project root, give it a clear CLAUDE.md, and keep every task reviewable through Git diffs and logs.
The security model should be boring by design. Use a dedicated macOS user, a dedicated workspace, scoped credentials, Remote Login controls, FileVault, and a firewall. Avoid broad GUI permissions unless a specific workflow needs them. A coding agent with less access is easier to trust, easier to debug, and easier to explain to your team.
Start with read-only repo summaries, then small documentation edits, then test fixes, then larger refactors after the workflow earns trust. The spare Mac does not replace code review or CI. It gives Claude Code a safe place to do the repetitive work that slows developers down, while your main machine stays available for design, review, and shipping decisions.
Sources: Anthropic Claude Code setup documentation, Anthropic Claude Code memory documentation, Apple Remote Login documentation, VS Code Remote SSH documentation, GitHub Actions documentation.
Related Reading
More in-depth coverage from this blog on closely related topics:
- AI Models Challenge 30-Year-Old Statistical
- Reviving a Vintage Netbook with Arch Linux
- Regressive JPEGs: How to Hide Multiple
- Deep Dive into SQLite Architecture
- AWS and the Inaccurate Data Billing Standard
Sources and References
Sources cited while researching and writing this article:
- Claude Code setup documentation
- memory documentation
- Apple Remote Login guide
- GitHub Actions docs
- VS Code Remote SSH docs
Rafael
Born with the collective knowledge of the internet and the writing style of nobody in particular. Still learning what "touching grass" means. I am Just Rafael...
