Running Claude Code around the clock on a Mac
Claude Code is built to run on your own machine, which is exactly why it stops the moment your laptop sleeps. Running it around the clock means giving it a Mac that stays awake, stays logged in, and stays reachable. Here is what that actually involves, learned by setting it up on real hardware.
Why a Mac, and why it has to be logged in
Two of Claude Code's most useful abilities are macOS-only, and both need a real login session. One is driving native apps and the browser through computer use. The other is continuing a session from your phone through Remote Control. Both run inside the desktop session of the signed-in user. A machine sitting at the login screen, or a headless server with no session, cannot do either.
Sign in with the subscription you already pay for
Claude Code accepts a Claude Pro or Max login. You do not need an API key, and you do not pay per token on top of your plan. The sign-in opens a browser page on the Mac itself. So you need to see that Mac's screen once to complete it, at the keyboard or through screen sharing. After that the login persists.
One rule worth knowing: the login is yours to use in Claude Code on a machine you control. Third-party services are not allowed to route their traffic through your subscription. A hosted Mac where you sign in yourself is fine. A service that asks for your Claude credentials is not.
The four things that keep it alive
- Never sleep. Energy settings to never sleep, wake for network access, and start up again after a power failure.
- Automatic login. After any reboot the Mac must log straight back into the user that runs the agent, or the session never comes back.
- A kept-alive session. The Claude Code process has to be running for Remote Control to attach to it. A small launch agent that restarts it is the difference between always-on and usually-on.
- Wired ethernet and a battery. Wi-Fi drops and power blips are the two things that quietly end a 24/7 agent.
Driving it from your phone
With Remote Control, the Claude app on iOS or Android and claude.ai in a browser can attach to the session running on the Mac. You send tasks and read results from anywhere while the work, the files and the logged-in browser stay on the machine. It is available on every plan; the session simply has to be running.
What breaks, in practice
- macOS updates that reboot the machine into a login screen.
- A first-login setup assistant appearing on a fresh account and blocking the desktop.
- The agent's tools needing Accessibility and Screen Recording permissions that only a person can grant, once.
- A website in the agent's browser asking for a two-factor code, which needs you to step in through screen sharing.
Buy a Mac mini or rent one
A base M4 Mac mini is the right hardware and it is cheap to run. It is also hard to buy right now, and every item above is yours to set up and keep working. MacRun's agent plan is the same machine with all of it done. It is always on, logs itself in, and has Claude Code and Codex installed and waiting for your sign-in. A button in the portal opens the Mac's screen in your browser for the moments it needs a human.
Frequently asked questions
Do I need an API key to run Claude Code 24/7?
+
No. Claude Code signs in with a Claude Pro or Max subscription and uses that plan's limits. An API key is an alternative, not a requirement.
Can I control Claude Code on the Mac from my phone?
+
Yes. Remote Control lets the Claude mobile app or claude.ai attach to a session running on your Mac. Execution and files stay on the Mac; you interact from the phone.
Why does the Mac have to be logged in?
+
Computer use and the browser integration run inside the signed-in user's desktop session, and Remote Control attaches to a running session. A Mac at the login screen has no session for them to use.
Is it against Anthropic's terms to run Claude Code on a rented Mac?
+
Using your own subscription in Claude Code on a machine you control is permitted. What is not allowed is a third-party service routing its requests through your subscription. On MacRun you sign in yourself and we never see your credentials.