MacOS - How to keep your MacBook awake, even when the lid is closed.

First off, we're going to show you how to accomplish to keep your MacBook awake after closing the lid in two simple steps. After that, we're going to explain why this isn't a feature of our Mac app Caffeinated.

Step 1: Open Terminal

There are several ways to find and open Terminal on your Mac. One of the quickest and easiest ways to open it is with Spotlight Search.

  1. You can use the keyboard shortcut Command + Space to open Spotlight Search on your Mac. Or click on the Spotlight Search button in your menu bar.

  2. Type in "Terminal".

  3. You should see the Terminal application under Top Hit at the top of your results. Double-click it and Terminal will open.

Step 2: Run Command

There are essentially two commands you will need. One for keeping your MacBook awake (even with the lid closed) and the second one you'll use whenever you'd like to let your MacBook sleep again.

Note: Keeping your MacBook running while the lid is closed, will potentially trap heat between the display and the keyboard of your MacBook.

1) Command to deactivate Lid-Sleep (keep system awake,开启合盖不休眠模式)

javascript 复制代码
sudo pmset -b sleep 0; sudo pmset -b disablesleep 1

2) Command to activate Lid-Sleep (let system sleep again, like normal,关闭合盖不休眠模式)

bash 复制代码
sudo pmset -b sleep 5; sudo pmset -b disablesleep 0

Simply copy the desired command from above and paste it in Terminal. Hit Enter . Since these commands are sudo commands, they require your password to run. Therefore, simply enter your password and hit Enter again. Voilà! That's how to keep MacBook awake with lid closed.

Why is this not a feature of Caffeinated?

Well, we would love to implement this feature, but for now it's simply not possible due to Apple's guidelines and restrictions for apps available on the App Store.

These limitations are not a bad thing, as they help preventing harmful software (malware) on your Mac. Apple tries to keep the system safe and clean. Even though this comes with limitations for us developers, we appreciate this, especially from a users perspective.

相关推荐
小手智联老徐4 分钟前
在 macOS 上使用 Lima 虚拟机安全部署 OpenClaw:构建你的 AI 隔离沙箱
人工智能·安全·macos·ai智能体·openclaw
❀͜͡傀儡师1 小时前
macOS/Linux Gemini CLI安装指南
linux·运维·macos
liangshanbo12151 天前
[特殊字符] Yazi 终极指南:从安装到精通 (macOS 专属)
macos
袁庭新1 天前
M系列芯片Mac上通过Homebrew一键安装/卸载Nginx并上线项目全指南
运维·nginx·macos·袁庭新·袁庭新ai
北冥有鱼被烹1 天前
【vibo经验记录】Mac 配置 Claude Code + 远程 Ollama 完全指南
macos·claude code·openclaw
无巧不成书02181 天前
FFmpeg 保姆级安装教程!Windows/macOS/Linux全平台覆盖,
windows·macos·ffmpeg
I'm Jie1 天前
MacOS 国内镜像一键安装 Homebrew
git·macos·homebrew
lucky_syq1 天前
Mac电脑部署OpenClaw保姆级教程(2026最新版)
人工智能·macos·开源·电脑·openclaw
todoitbo1 天前
用虚拟局域网打通 Win/Mac/Linux 三端:跨设备协作的实用方案
linux·运维·macos
姓王名礼2 天前
一份 Windows/macOS/Linux 完整安装 + 运行 + 对接 WebUI 的步骤
linux·windows·macos