Files
nexus/wiki/concepts/pmset.md
2026-04-17 08:38:12 +08:00

48 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "pmset"
type: concept
tags: [macos, power-management, command-line]
date: 2026-04-17
---
## Definition
pmset 是 macOS 的电源管理命令行工具,用于查询和修改系统睡眠、显示器关闭、待机模式等电源相关设置。
## Usage
```bash
# 查看当前电源设置
pmset -g
# 禁止系统睡眠
sudo pmset -a sleep 0
# 禁止显示器关闭
sudo pmset -a displaysleep 0
# 禁止待机模式
sudo pmset -a standby 0
# 禁止休眠
sudo pmset -a hibernatemode 0
# 启用网络唤醒
sudo pmset -a womp 1
```
## Parameters
| 参数 | 作用 |
|------|------|
| `-a` | 应用于所有电源模式(电池和电源适配器) |
| `-b` | 仅电池模式 |
| `-c` | 仅电源适配器模式 |
| `sleep` | 系统睡眠时间分钟0 为禁止) |
| `displaysleep` | 显示器关闭时间分钟0 为禁止) |
| `standby` | 待机模式0 为禁止) |
| `hibernatemode` | 休眠模式0 为禁止) |
| `womp` | 网络唤醒1 为启用0 为禁用) |
## Related Concepts
- [[caffeinate]]:临时保持唤醒的工具
- [[WOL (Wake on LAN)]]:网络唤醒功能
- [[休眠 (Hibernate)]]:内存数据写入磁盘后完全断电
- [[待机 (Suspend)]]:内存保持供电的低功耗睡眠状态