Files
nexus/wiki/concepts/pmset.md
weishen e62797a33a Batch 9: Obsidian插件/AI开源平替/Coze培训/TK面单/Ubuntu科学上网
- Sources: 5个新文档
- Concepts: ProxyChains, SOCKS5代理, Docker Daemon代理
- Index: 更新至 Batch 9
- 累计 sources: 108/182
2026-04-16 06:36:36 +08:00

36 lines
1.3 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, cli, server]
date: 2026-03-15
---
## Definition
pmsetmacOS 系统电源管理命令行工具,用于查看和修改 Mac 的电源管理设置,包括睡眠、显示器休眠、待机模式、休眠模式和网络唤醒等行为。
## Key Commands
| 命令 | 作用 | 参数 |
|------|------|------|
| `pmset -a sleep 0` | 禁止系统睡眠 | `-a` 所有模式 |
| `pmset -a displaysleep 0` | 禁止显示器关闭 | `-a` 所有模式 |
| `pmset -a standby 0` | 禁止待机模式 | `-a` 所有模式 |
| `pmset -a hibernatemode 0` | 禁止休眠(内存→磁盘) | `-a` 所有模式 |
| `pmset -a womp 1` | 启用网络唤醒WOL | `-a` 所有模式 |
| `pmset -g` | 查看当前电源设置 | 全局状态 |
## Parameters
- `-a`:所有电源模式(电池+电源适配器)
- `-b`:仅电池模式
- `-c`:仅电源适配器模式
## Use Cases
- 无头服务器配置:关闭所有睡眠,确保 SSH/RustDesk 远程访问始终可用
- WOL 远程开机:配合 `wakeonlan` 命令实现远程开机
## Related Concepts
- [[caffeinate]]:临时防止睡眠,不修改系统设置
- [[WOL]]Wake-on-LANpmset -a womp 1 是其前提条件
## Source
[[Mac-Mini-服务器配置-防止自动锁屏与睡眠]]