Files
nexus/wiki/sources/mac-mini-server-prevent-auto-lock-sleep.md
2026-04-17 08:38:12 +08:00

46 lines
2.1 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: "Mac Mini 服务器配置:防止自动锁屏与睡眠"
type: source
tags: []
date: 2026-03-15
---
## Source File
- [[raw/Home Office/Mac-Mini-服务器配置-防止自动锁屏与睡眠.md]]
## Summary
- 核心主题Mac Mini 作为服务器时的电源管理配置,防止自动锁屏和睡眠
- 问题域:远程访问场景下 Mac Mini 自动进入睡眠状态导致无法连接
- 方法/机制:通过 pmset 命令关闭系统睡眠、显示器睡眠、待机模式和休眠;可选 caffeinate 临时保持唤醒
- 结论/价值:确保 Mac Mini 持续可用,支持 7×24 小时远程访问
## Key Claims
- Mac Mini 关闭显示器后会自动锁屏或进入睡眠状态,导致远程访问软件(如 RustDesk、VNC无法连接
- 使用 `pmset -a sleep 0` 可禁止系统睡眠
- 使用 `pmset -a displaysleep 0` 可禁止显示器关闭
- 使用 `pmset -a standby 0` 可禁止待机模式
- 使用 `pmset -a hibernatemode 0` 可禁止休眠(内存保存到磁盘)
- 使用 `pmset -a womp 1` 可启用网络唤醒WOL
- `-a` 参数表示应用于所有电源模式(电池和电源适配器)
- 可选方案:使用 caffeinate 工具临时保持唤醒状态,不修改系统设置
## Key Quotes
> "Mac Mini 作为服务器使用时,关闭显示器后会自动锁屏或进入睡眠状态,导致远程访问软件(如 RustDesk、VNC无法连接需要物理到主机上输入密码解锁。"
## Key Concepts
- [[pmset]]macOS 电源管理命令行工具,用于配置睡眠、显示关闭、待机等功能
- [[caffeinate]]macOS 工具,用于临时防止系统睡眠
- [[WOL (Wake on LAN)]]:网络唤醒功能,允许通过局域网信号唤醒设备
## Key Entities
- [[Mac Mini]]Apple Mac Mini M4作为服务器使用需要保持持续运行
- [[RustDesk]]:开源远程桌面软件,用于远程访问 Mac Mini
- [[Apple]]Apple 公司macOS 系统的开发者
## Connections
- [[Mac Mini]] ← configured_with ← [[pmset]]
- [[pmset]] ← enables ← [[WOL (Wake on LAN)]]
- [[caffeinate]] ← alternative_to ← [[pmset]] (临时唤醒 vs 永久配置)
## Contradictions
- (暂无)