Minimal macOS menu bar app that keeps your Mac awake with the lid closed — no AC power required.
- macOS 11.0+
- Swift 5.5+
- Terminal
bash build.shOutput: build/free-clamshell-mode.app
cp -r build/free-clamshell-mode.app ~/Applications/Then open the app and enable Settings > Launch at Login.
- Build and open the app
- Clam shell icon appears in the menu bar
- Left-click the icon to toggle on/off
- Right-click (or Ctrl+click) to open the menu
The icon turns into a green scallop fan when active.
Uses sudo pmset -a disablesleep 1 to prevent the system from sleeping when the lid is closed, regardless of power source.
| State | Command |
|---|---|
| Enable | sudo pmset -a disablesleep 1 |
| Disable | sudo pmset -a disablesleep 0 |
On first activation the app writes a sudoers rule so pmset can run password-free on all future uses:
/etc/sudoers.d/free-clamshell-mode
<username> ALL=(ALL) NOPASSWD: /usr/bin/pmset
You will see a macOS admin password dialog once. After that, no password is ever needed again — even after restarts.
To remove this permission manually:
sudo rm /etc/sudoers.d/free-clamshell-mode| Setting | Default | Description |
|---|---|---|
| Launch at Login | Off | Auto-start on login via SMAppService |
| Hide from Dock | On | App appears only in the menu bar |
| Show Warnings | On | Confirm dialog before enabling |
If the app is force-quit while active, disablesleep remains set to 1. Restore normal sleep behavior manually:
sudo pmset -a disablesleep 0A clean quit (Cmd+Q or Quit from the menu) always resets disablesleep to 0 automatically.
macOS blocks app after rebuild (code signature mismatch):
codesign --remove-signature build/free-clamshell-mode.app"Permission denied":
chmod +x build/free-clamshell-mode.app/Contents/MacOS/free-clamshell-mode"Compilation failed":
xcode-select --installpmset disablesleep stuck at 1:
sudo pmset -a disablesleep 0