<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[MacRun Guides]]></title><description><![CDATA[MacRun Guides]]></description><link>https://macrun.hashnode.dev</link><image><url>https://cdn.hashnode.com/uploads/logos/6adf4f525bb6fa9a24a4c747/af80caa7-0838-4dd9-892f-a175ee61f078.png</url><title>MacRun Guides</title><link>https://macrun.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Thu, 29 Oct 2026 21:16:45 GMT</lastBuildDate><atom:link href="https://macrun.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Claude Code stops when your Mac sleeps: the quick fixes]]></title><description><![CDATA[Your Mac went to sleep and Claude Code froze. Fix it with caffeinate and pmset, in the order to try them, with copyable commands.]]></description><link>https://macrun.hashnode.dev/claude-code-stops-when-your-mac-sleeps-the-quick-fixes</link><guid isPermaLink="true">https://macrun.hashnode.dev/claude-code-stops-when-your-mac-sleeps-the-quick-fixes</guid><category><![CDATA[Developer Tools]]></category><category><![CDATA[macOS]]></category><category><![CDATA[AI]]></category><category><![CDATA[Productivity]]></category><dc:creator><![CDATA[MacRun]]></dc:creator><pubDate>Mon, 26 Oct 2026 13:07:57 GMT</pubDate><content:encoded><![CDATA[<p>You gave Claude Code a long task, closed the lid, and came back to a dead session. Nothing is wrong with the agent. macOS put the machine to sleep, and sleep suspends every process, drops the network, and ends any SSH connection. This page covers the settings that stop that, in the order to try them, and the point where the honest fix is a different machine.</p>
<h2>What actually happens at sleep</h2>
<p>When a Mac sleeps, the CPU stops running your processes. The agent is not killed. It is frozen. When the machine wakes, the process continues. By then the API connection it was using has timed out. The tool call it was in the middle of has failed. On a laptop, a closed lid means sleep within seconds unless something prevents it. A lock screen does not cause sleep. A screensaver does not either. Only the sleep timer and the lid do.</p>
<h2>Fix 1: caffeinate for a single task</h2>
<p>macOS ships a tool that holds the machine awake while a command runs. Start the agent through it and the Mac stays up until the agent exits.</p>
<pre><code class="language-plaintext">caffeinate -i claude
</code></pre>
<p>The flag keeps the system from idle sleeping. Add a second flag to keep the display on too, which matters only for tools that drive the screen.</p>
<pre><code class="language-plaintext">caffeinate -di claude
</code></pre>
<p>This does not survive a closed laptop lid. The lid switch overrides every idle assertion. It also does nothing after the agent exits and you start the next task without it.</p>
<h2>Fix 2: turn off sleep for the machine</h2>
<p>On a desktop Mac, or a laptop on power, set the sleep timer to never and leave it. These are the settings we use on every agent Mac.</p>
<pre><code class="language-plaintext">sudo pmset -a sleep 0
sudo pmset -a disksleep 0
sudo pmset -a displaysleep 10
sudo pmset -a womp 1
</code></pre>
<p>The display can still sleep. That saves power and changes nothing for a terminal process. The last line enables wake on network, which helps if something does put the machine down.</p>
<p>That covers the quick fixes. The full guide also covers the closed lid, keeping the terminal session alive with tmux, coming back after a reboot, and when a laptop is the wrong machine for an always-on agent: <a href="https://macrun.dev/guides/claude-code-stops-when-mac-sleeps?ref=hashnode">read the full guide on</a> <a href="http://macrun.dev">macrun.dev</a>.</p>
<p><em>Full disclosure, I run MacRun, which rents dedicated Mac minis for builds and coding agents.</em></p>
]]></content:encoded></item></channel></rss>