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.

相关推荐
做萤石二次开发的哈哈12 小时前
开发者如何调用 ERTC iOS API 完成 SDK 初始化配置?
macos·objective-c·cocoa
AUV110714 小时前
Mac 录屏自动缩放怎么设置才不乱跳:自动片段、固定区域与鼠标跟随调试
macos·计算机外设
程序员良辰15 小时前
【Mac快速切换JDK】Mac 使用 Homebrew + jenv 快速切换 JDK 版本
java·开发语言·macos
coding4u1 天前
Mac 外接显示器完全指南:从插上线到调好每个参数
macos·计算机外设·文件管理·显示器·策略模式·quick look扩展
zhyf1191 天前
(Mac)Homebrew部署Obsidian+Claudian+Excalidraw
macos
chuan.bai1 天前
Java RAG 实战(第 3 篇):从交互式聊天到多轮上下文
java·人工智能·macos·ai
Chennn__2 天前
开源项目:Recorder — 本地离线 macOS 录音转文字(通用/课堂/雅思,可选 Ollama)
macos
AUV11072 天前
录系统声音用什么 Mac 录屏软件:双音源到成片的五层验收
macos
chuan.bai2 天前
Java RAG 实战专栏导读:从零跑通 Ollama + Qdrant + Spring Boot 知识库
java·人工智能·macos·ai
向阳是我2 天前
两台 Mac 远程共享屏幕最佳方案:Tailscale + macOS 原生屏幕共享
macos