_______ .______ _______ _______ ______ __ ___ .___ ___. _______. __ __ _______ __ __ .___ ___. ______ _______ _______
| ____|| _ \ | ____|| ____| / || | / \ | \/ | / || | | | | ____|| | | | | \/ | / __ \ | \ | ____|
| |__ | |_) | | |__ | |__ ______| ,----'| | / ^ \ | \ / | | (----`| |__| | | |__ | | | | ______| \ / | | | | | | .--. || |__
| __| | / | __| | __| |______| | | | / /_\ \ | |\/| | \ \ | __ | | __| | | | | |______| |\/| | | | | | | | | || __|
| | | |\ \----.| |____ | |____ | `----.| `----./ _____ \ | | | | .----) | | | | | | |____ | `----.| `----. | | | | | `--' | | '--' || |____
|__| | _| `._____||_______||_______| \______||_______/__/ \__\ |__| |__| |_______/ |__| |__| |_______||_______||_______| |__| |__| \______/ |_______/ |_______|
Minimal macOS menu bar app that keeps your Mac awake with the lid closed — no AC power required.
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