SSH + VPS for AI Development

Stop melting your Mac. Run Codex, Claude Code, builds, and APIs on a remote Linux box — your laptop becomes a display.

← Part of the Tech knowledge base  ·  AI Agents knowledge base

Source: Post by J J (@jturntdev) — Read the original post on X

Why This Is a 10x Upgrade

If you run multiple Codex or Claude Code sessions, git worktrees, local dev servers, and APIs all on your Mac, you already know the problem: fans spinning, RAM maxed, everything slows down, and closing your laptop kills long-running agent work.

The fix is simple: move the compute to a Linux VPS and use SSH to connect from your Mac. Your laptop becomes a thin client. All the heavy lifting happens remotely.

@jturntdev calls this one of the biggest dev upgrades he's made. Here's why — and how to set it up for yourself and your team.

The Five Reasons to Move Agents to a VPS

1. Performance

Worktrees, multiple Codex/Claude sessions, builds, and APIs no longer compete with Chrome, Slack, and Figma for your Mac's CPU and RAM. SSH in, run everything on the VPS, and let your laptop breathe.

2. Cost

Instead of buying a £3k+ Mac just to run more agentic workflows, rent serious Linux compute monthly — and scale up when you need it. @jturntdev runs 12 AMD vCPU / 24GB RAM for agents, builds, APIs, and dev servers without breaking a sweat.

3. Persistence

The underrated win. When your Mac sleeps, closes, or dies, your agents keep running on the VPS. Pair SSH with tmux and sessions survive disconnects — pick up exactly where you left off.

4. Cleaner Workflow

Clear separation of concerns: Mac for display, VPS for dev compute, GitHub for source of truth, production as a separate protected deploy target. No more mixing experiments with your daily driver machine.

5. Simple Setup

You can literally ask Codex or Claude Code to walk you through it. The stack is boring on purpose — Ubuntu, SSH keys, git, Node, Docker, tmux. Boring infrastructure is reliable infrastructure.

The Architecture

Mac (thin client)
  └── SSH / VS Code Remote SSH / Codex remote connection
        └── Linux VPS (Ubuntu 24.04)
              ├── Codex / Claude Code (agent sessions)
              ├── git worktrees + builds + tests
              ├── dev servers + APIs
              └── tmux (persistent sessions)

GitHub  →  source of truth (clone, push, PRs)
Production  →  separate deploy target (Railway, etc.) — never your dev VPS

Session management on the Mac side can also use cmux — a native macOS terminal built for running AI coding agents in parallel. @jturntdev recommends it for this workflow alongside tmux on the VPS.

What Is SSH? (30-Second Version)

SSH (Secure Shell) is how you securely log into a remote computer over the internet and run commands as if you were sitting at its keyboard. No monitor plugged into the VPS — just an encrypted tunnel from your Mac to the server.

You authenticate with an SSH key pair (a private key on your Mac, a public key on the VPS) instead of typing a password every time. Once connected, you get a terminal on the remote machine. Tools like VS Code Remote SSH turn that into a full IDE experience on the VPS filesystem.

Step-by-Step Setup

Based on @jturntdev's guide, expanded with team-friendly details.

1. Buy a Linux VPS

Any provider works — Hetzner, DigitalOcean, Vultr, Linode, OVH, etc. Pick a region close to you. For agent-heavy work, aim for at least 8 vCPU / 16GB RAM; @jturntdev runs 12 vCPU / 24GB. Note: VPS prices have been rising — locking in a plan early helps.

2. Choose Ubuntu 24.04

Most guides, AI tools, and packages assume Ubuntu. Stick with the LTS release for stability.

3. Generate an SSH Key (on your Mac)

If you don't already have one:

ssh-keygen -t ed25519 -C "your-email@example.com"

Press Enter to accept the default path (~/.ssh/id_ed25519). Optionally set a passphrase for extra security. Your public key is ~/.ssh/id_ed25519.pub — that's what goes on the VPS.

4. Add Your SSH Key to the VPS

Most VPS dashboards have an "SSH Keys" section during setup — paste your public key there. Or, if you have password access:

ssh-copy-id root@YOUR_VPS_IP

5. SSH from Your Mac

ssh root@YOUR_VPS_IP

You're in. This is a remote Linux terminal.

6. Create a Dev User (recommended for teams)

Don't run daily work as root. Create a dedicated user per person or per project:

adduser dev
usermod -aG sudo dev
mkdir -p /home/dev/.ssh
cp ~/.ssh/authorized_keys /home/dev/.ssh/
chown -R dev:dev /home/dev/.ssh
chmod 700 /home/dev/.ssh
chmod 600 /home/dev/.ssh/authorized_keys

Then connect as ssh dev@YOUR_VPS_IP.

7. Install Your Dev Stack

sudo apt update && sudo apt upgrade -y
sudo apt install -y git curl build-essential tmux

# Node via nvm (or your preferred method)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
source ~/.bashrc
nvm install --lts
npm install -g pnpm

# Docker (for consistent environments — see our Docker guide)
curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER

8. Clone Your Repo

git clone git@github.com:YOUR-ORG/your-repo.git
cd your-repo
pnpm install   # or npm install, etc.

Use SSH URLs for GitHub — more reliable for larger repos. See GitHub repo duplication guide for SSH setup tips.

9. Connect Your IDE

  • VS Code Remote SSH — Install the "Remote - SSH" extension, add your host, open the project folder on the VPS. Full extensions, terminal, and file tree — all remote.
  • Codex remote connection — Connect Codex directly to the VPS environment so agents run where the code lives.
  • Claude Code — Run inside the VPS terminal or via Remote SSH. Agents operate on the server filesystem, not your Mac.

10. Use tmux for Persistence

Before starting a long agent session:

tmux new -s agents

Run your Codex/Claude/build work inside that session. If SSH disconnects, reattach:

tmux attach -t agents

List sessions with tmux ls. Your agents keep running while your laptop is closed.

11. Forward Ports for Local Testing

When a dev server runs on the VPS (e.g. localhost:3000), forward it to your Mac:

ssh -L 3000:localhost:3000 dev@YOUR_VPS_IP

Now open http://localhost:3000 on your Mac — it tunnels to the VPS. VS Code Remote SSH handles this automatically for many setups.

Make SSH Easy: ~/.ssh/config

Stop typing IP addresses. On your Mac, edit ~/.ssh/config:

Host devbox
  HostName YOUR_VPS_IP
  User dev
  IdentityFile ~/.ssh/id_ed25519
  LocalForward 3000 localhost:3000

Now just run ssh devbox. Share this pattern with your team — everyone uses the same host alias, different keys.

Setting This Up for Your Team

  • One VPS per developer — simplest isolation. Each person gets their own box, own agents, own experiments. No stepping on each other's worktrees.
  • Shared VPS with per-user accounts — cheaper, but requires discipline. Separate Linux users, separate home directories, separate tmux sessions. Don't share root.
  • Standardize the stack — same Ubuntu version, same Node version, same tmux config, same .ssh/config host alias pattern. Reduces "works on my VPS" problems.
  • GitHub stays source of truth — VPS is ephemeral compute. Code lives in git, not on someone's laptop or a single server. Push early, push often.
  • Production is separate — never deploy production from your dev VPS. Use Railway or another managed target. Dev VPS is for agents, builds, and experiments.
  • Document the setup once — write a one-pager (or ask an agent to generate it from this page) so new team members can be productive in an afternoon.

This pairs naturally with AI Chief of Staff patterns (persistent orchestration across worktrees) and team archetype thinking — your Builders and Prototypers need reliable compute, not a overheating laptop.

Security Basics (Don't Skip)

  • SSH keys only — disable password authentication on the VPS once keys work.
  • Firewall — only open ports 22 (SSH) and whatever you explicitly need. Use ufw on Ubuntu.
  • Don't expose dev servers publicly — use SSH port forwarding or a VPN, not open 0.0.0.0:3000 to the internet.
  • Keep the VPS updatedsudo apt update && sudo apt upgrade regularly.
  • Separate prod credentials — dev VPS should not have production database URLs or API keys unless absolutely necessary.

Quick Reference Commands

Task Command
Connect to VPS ssh dev@YOUR_VPS_IP
Start persistent session tmux new -s agents
Reattach after disconnect tmux attach -t agents
Forward dev server port ssh -L 3000:localhost:3000 dev@YOUR_VPS_IP
Copy file to VPS scp localfile.txt dev@YOUR_VPS_IP:~/
Check VPS resources htop or free -h && df -h

Key Takeaways

  • SSH lets you run a full dev environment on a remote Linux VPS from your Mac.
  • Moving Codex/Claude Code agents to the VPS frees your laptop and keeps sessions alive via tmux.
  • Renting compute beats buying a maxed-out Mac for agent-heavy workflows.
  • Mac = display. VPS = compute. GitHub = source of truth. Production = separate deploy.
  • Setup is straightforward — and you can have an AI agent walk you through every step.

Related Guides

Docker for Vibe Coders

Consistent environments from laptop to cloud — install Docker on your VPS for reproducible builds.

Read the guide →

Harness: AI Coding Tips

Includes remote dev containers and SSH-based isolation for safe YOLO mode with agents.

Read the tips →

AI Chief of Staff

Persistent orchestration across worktrees — runs even better with dedicated VPS compute.

Read the deep dive →

Deploy to Railway

Keep production separate from your dev VPS — deploy apps to Railway when they're ready.

Read the guide →

GitHub SSH for Repos

Use SSH URLs for cloning and pushing — more reliable for larger repos on your VPS.

Read the guide →

The 5 Roles in AI-First Companies

How to think about team design when everyone has VPS-powered agent workflows.

Read the framework →

Browse more in the Tech category and AI Agents category.

Framework and setup guide from J J (@jturntdev).
View the original post on X →