Skip to content

Claude Code and Codex, on the Mac that stays home

Run Claude Code and Codex on a Mac mini, from your laptop.

Start Claude Code and Codex sessions in a Mac mini project right from your laptop’s sidebar. They run on the Mac mini with its own sign-ins, keep working when you close the lid, and wait for you marked Done, with the answer in the tab.

How to set up the Mac mini

Started from your laptop

Open one of the Mac mini's projects in your sidebar and start Claude Code or Codex in a tab. The session runs on the Mac mini, signed in with its accounts.

Close the lid, they keep going

Your laptop leaving ends the connection, not the session. Claude Code and Codex carry on, and the Mac mini keeps their recent output.

Come back to Done

Reconnect and each finished session shows Done and how long it worked, its answer in the tab. When one needs you, the chime goes to the Mac you used last, if it's connected.

Pair once, then run Claude Code and Codex on the Mac mini

MacBook AirYour laptop

Add a Mac

Connect this Mac to another Mac running lpm.

On this network

Mac miniNearby on this networkConnect

Open its projects here

Paste invite from the other MacConnect
Enter details manually
Mac miniStays on
Allow control of this MacOn · works on this network only
Same network192.168.1.24 · only while the other Mac is on this network

Your Macs

Nothing connected yet.

On your laptop, + → Another computer lists the Macs nearby. Click one and accept on the Mac mini once both screens show the same 6-digit code. Then start Claude Code and Codex in one of its projects: they run on the Mac mini, and your sidebar shows what each is doing.

Don't see it nearby? Paste a one-time invite from the Mac mini, or type its address and code.

The short answer

Can Claude Code and Codex run on a Mac mini while you use your laptop?

Yes. Claude Code and Codex are command-line tools, so they run on a Mac mini just as they do on your laptop, and there a long run doesn’t end when you close the lid. The hard part is reaching them. Screen Sharing hands you a whole second desktop in a window. ssh and tmux hand you a shell that can’t tell you which agent finished or which one is waiting on you.

With lpm on both Macs, you pair them once from + → Another computer above your projects. The Mac mini’s projects then sit in your laptop’s sidebar. Open one and start Claude Code or Codex in a tab: the session runs on the Mac mini, with the CLIs and sign-ins installed there. Close the laptop, and when it reconnects, the sidebar shows each finished session as Done with how long it worked, and its answer is in the tab.

Any Mac or PC running lpm can do this job. A Mac mini is the usual pick: it is small, quiet, and has no lid to close. If you would rather rent a machine than keep one at home, run Claude Code and Codex on a Linux VPS instead.

Watch it

Close the laptop, come back to finished work

A lesson from the lpm series, recorded with a Mac mini: start Claude Code and Codex there from the laptop, disconnect, and both are done when the laptop reconnects.

  1. 1

    Pair the Mac mini

    On the Mac mini, create an invite in Settings → Connections and copy it. On your laptop, click + above your projects, choose Another computer, paste it and click Connect. The Mac mini's projects appear in your sidebar.

  2. 2

    Start Claude Code and Codex there

    Open a project on the Mac mini and give each agent its task. They run on the Mac mini, signed in with its accounts, not on your laptop.

  3. 3

    Close the laptop, then come back

    Disconnect and walk away. When your laptop reconnects, both agents show Done and how long they worked, with their answers waiting in the tabs.

Every lpm lesson on YouTube
Starting a session

Start Claude Code and Codex on the Mac mini from your laptop

A Mac mini project opens in the same window as your local ones. The sessions you start there run on the Mac mini, and you type into them from here.

Start them in a Mac mini project

Open the project from your sidebar and start Claude Code or Codex in a tab, the way you would in a local one. The process belongs to the Mac mini, not to your laptop.

The Mac mini's sign-ins

Sessions use the Claude Code and Codex installed and signed in on the Mac mini, so its accounts do the work and spend their usage limits. Your laptop's sign-ins stay out of it.

Its Claude accounts, from your laptop

Right-click the Mac mini in your sidebar and choose Settings on Mac mini… to add its Claude accounts or sign one in. The sign-in runs in a terminal on the Mac mini that you type into from here.

Several at once, on its cores

Run Claude Code in one tab and Codex in another, across the Mac mini's projects, or split a tab to watch two side by side. Their builds and tests use the Mac mini's CPU, not your laptop's.

To check what they built, the review pane shows the Mac mini’s changes, and its dev servers open on your laptop’s localhost.

Leaving and coming back

Close the laptop. Claude Code and Codex keep working.

The sessions run on the Mac mini, so your laptop leaving ends a connection, not a run.

  1. You start a run

    Give Claude Code or Codex a task in a Mac mini project. The process belongs to lpm on the Mac mini, not to your laptop or its Wi-Fi.

  2. You close the lid

    Close it, quit lpm, or lose the connection. Only the link goes. The Mac mini keeps both sessions running and keeps their recent output.

  3. One finishes or needs you

    While your laptop is connected, the chime and the banner go to it, the Mac you used last. With the laptop shut, lpm Link on your iPhone can tell you instead.

  4. You come back

    lpm reconnects on its own. The sidebar shows each session as Done with how long it worked, or as Needs you, and each tab carries on from where you left it, the answer already in it.

Two limits worth knowing. A session that printed more than 512 KB while you were gone, or one you come back to after quitting lpm on the laptop, reopens with its recent output on a fresh screen rather than every line. And the Mac mini itself has to stay awake with lpm open: set it up once.

On your phone

Answer Claude Code from your iPhone, laptop shut

lpm Link, the lpm app for iPhone and iPad, shows the Mac mini's Claude Code and Codex sessions, tells you when one needs you or finishes, and lets you reply in its terminal.

Paired with the Mac mini

Right-click the Mac mini in your laptop's sidebar, choose Pair a phone…, and scan the code with lpm Link. The phone then connects to the Mac mini itself, gets its notifications, and lets you type an answer to Claude Code or Codex with your laptop shut.

Through your laptop

A phone paired only with your laptop can open the Mac mini through it, with nothing more to set up, for as long as the laptop is awake and connected. The Mac mini's notifications reach only phones paired with it.

The phone needs a way to reach the Mac mini: your home network, or Tailscale when you are out. More on lpm Link for iPhone.

Pairing

Pair the Mac mini once

Install lpm on both Macs and turn on Allow control of this Mac on the Mac mini, in Settings → Connections. Then, on your laptop, click + above your projects and choose Another computer.

Tap it nearby

On the same network, click Connect next to the Mac mini, check that both screens show the same 6-digit code, and accept on the Mac mini.

Paste an invite

On the Mac mini, choose Add a Mac → Create invite and copy it. Paste it on your laptop and click Connect. An invite works once.

Type the address and code

Open Enter details manually and type what an invite holds: the Mac mini's address, port 8766, and the code shown under the invite.

  • Away from home

    Set up Built-in Tailscale in Settings → Connections on both Macs, with the same Tailscale account, and your laptop reaches the Mac mini's sessions from anywhere. No Tailscale app needed (macOS 12 or newer).

  • Direct and encrypted

    The two Macs talk directly over TLS pinned to the Mac mini's own certificate, not through a relay of ours, and the Mac mini keeps only a hash of each device's token.

The honest version

Set up the Mac mini once

Claude Code and Codex keep working on the Mac mini only while it is awake and lpm is open there. A few settings make that the normal state.

Plugged in and awake
In Settings → Connections, with Allow control on, open Port 8766 · keep awake and turn on Keep this Mac awake: lpm then keeps the Mac mini from sleeping while it's plugged in and Allow control stays on. Or stop it sleeping in macOS: in System Settings → Energy, turn on Prevent your Mac from automatically sleeping when the display is off.
Open lpm at login
lpm doesn't launch itself at login. Add it in System Settings → General → Login Items & Extensions, under Open at Login, so it opens again after a restart. Login items open once someone logs in, so a Mac mini that restarted waits at the login window until you sign in, unless automatic login is on (automatic login needs FileVault off).
Back after a power cut
In System Settings → Energy, turn on Start up automatically after a power failure. With lpm in Login Items, the Mac mini comes back and opens lpm once you log in, or on its own if automatic login is on, which needs FileVault off. Claude Code and Codex sessions that were running stopped mid-task; their tabs resume the conversations when you open the project again.
Close the window, don't quit
Closing lpm's window on the Mac mini only hides it, and Claude Code and Codex keep working. Quitting lpm there ends their tabs mid-task. The project's services keep running either way.
Update between runs
Updating lpm on the Mac mini, from its own Update button or from your laptop, restarts lpm there, and that stops its Claude Code and Codex tabs the same way a quit does.
Its own tools
Install Claude Code, Codex and your toolchain on the Mac mini and sign in there once. lpm sets itself up, not your stack.

If the Mac mini does fall asleep, Claude Code and Codex pause with everything else on it until it wakes, and your laptop shows the Mac mini as Not responding.

Choosing a machine

Mac mini or Linux server?

Both keep Claude Code and Codex working after your laptop leaves. They differ in how you set them up and what brings them back.

A Mac mini, or any Mac or PC

Setup
Install the lpm app on it, then pair from + → Another computer.
Connection
Direct, on port 8766, over your network or Tailscale.
After a restart
lpm opens again from Login Items once the Mac is logged in.
Sleep
Keep it plugged in, with Keep this Mac awake on.
Hardware
The Mac you already have, Apple silicon included.
Its screen
A desktop you can sit at: the Claude Code and Codex tabs you start from your laptop show there too.

A Linux server

Setup
Type what you would type after ssh, and lpm installs and pairs itself.
Connection
Through an SSH tunnel lpm keeps up, so nothing new is exposed.
After a restart
On a systemd server, lpm starts on boot as a service.
Sleep
A server doesn't sleep.
Hardware
Ubuntu 22.04 or newer, or Debian, on x86_64. ARM isn't supported yet.
Its screen
None: lpm runs there without one, driven from your laptop.

Already own a Mac that stays home? Start there. Renting a box instead? Here is how to run Claude Code and Codex on a Linux server.

FAQ

Claude Code and Codex on a Mac mini, answered

  • Do Claude Code and Codex keep running on the Mac mini after my laptop disconnects?

    Yes. Closing your laptop, letting it sleep or quitting lpm on it only ends the connection: Claude Code and Codex carry on on the Mac mini, which keeps their recent output. When your laptop reconnects, the sidebar marks each finished session done, with how long it worked. If the laptop slept or lost the connection, each terminal carries on from where you left it; after quitting lpm on it, a tab reopens with its recent output on a fresh screen. A session started on the laptop itself still pauses while the laptop is asleep.

  • Whose Claude Code and Codex account, and usage limits, does it use?

    The Mac mini's. Sessions run with the Claude Code and Codex installed and signed in on the Mac mini, so those accounts do the work and their usage limits are the ones spent. From your laptop, right-click the Mac mini in the sidebar and choose Settings on Mac mini… to add its Claude accounts or sign one in; the sign-in runs in a terminal on the Mac mini. When the same Claude account is signed in on both Macs, lpm passes its usage-limit readings between them, so each shows the latest.

  • Can I answer Claude Code from my phone?

    Yes, with lpm Link on iPhone or iPad. Right-click the Mac mini in your laptop's sidebar, choose Pair a phone…, and scan the code. The phone then connects to the Mac mini directly, over your home network or Tailscale, so it can tell you a session needs you and let you type the answer with your laptop shut. A phone paired only with your laptop can also open the Mac mini through it while the laptop is awake. More on lpm Link

  • What happens to a Codex session if the Mac mini sleeps or restarts?

    If the Mac mini sleeps, Codex pauses with everything else on it until it wakes, and your laptop shows the Mac mini as not responding. If it restarts, or lpm quits or updates there, Codex stops mid-task; when you open the project again, its tab resumes the conversation, so you can ask it to carry on. lpm doesn't relaunch on its own, so keep the Mac mini plugged in with Keep this Mac awake on, add lpm to Login Items, and turn on Start up automatically after a power failure.

  • Can I run several Claude Code sessions on the Mac mini?

    Yes. Start several Claude Code and Codex tabs, in one Mac mini project or across its projects, and split a tab to watch two side by side. They all run on the Mac mini's CPU and memory, and your laptop's sidebar lists each one under its project with what it is doing and for how long.

  • Does it work when I'm away from home?

    Yes, over Tailscale. Set up Built-in Tailscale in Settings → Connections on both Macs with the same Tailscale account, or use the Tailscale app. Invites carry the Mac mini's Tailscale address next to its home one, and a laptop that left home tries the address that worked last. Without Tailscale, your laptop reaches the Mac mini's sessions only on the same network.

  • Can I use a Windows PC or my old MacBook instead of a Mac mini?

    Yes. Any Mac or PC running lpm can run your Claude Code and Codex sessions, including a Windows PC or a Linux desktop; on Windows, turning on Allow control asks for a firewall permission the first time. An old MacBook works too if it stays plugged in with its lid open: Keep this Mac awake holds only on power, and closing a laptop's lid still puts it to sleep.

  • Is the connection between my laptop and the Mac mini encrypted?

    Yes, when both run a current lpm. The link is TLS, pinned to the Mac mini's own certificate: an invite carries its fingerprint, so it is checked from the first connection, and a different machine at the same address is refused. The two talk directly rather than through a relay of ours, the Mac mini keeps only a hash of each device's token, and you can remove any device's access in Settings → Connections.

  • Mac mini or a Linux VPS for Claude Code?

    Use the machine you have. A Mac mini you own costs nothing more and is also a desktop you can sit at, but it has to stay awake with lpm open, and you add lpm to Login Items yourself. A Linux VPS never sleeps and lpm starts there on boot, but it is one more machine to rent, and it has to be x86_64. Either way, you start and answer Claude Code and Codex from your laptop's sidebar. Run Claude Code on a Linux server