用 shutdown 命令在终端重启或关闭 Mac
用 macOS 自带的 shutdown 命令重启或关机——菜单栏无响应或远程连接时特别好用。
运行 sudo shutdown -r now 立即重启,或运行 sudo shutdown -h now 直接关机。
01命令
命令
$ sudo shutdown -r now02作用说明
shutdown 是苹果自带的、用于安全停止或重启系统的命令:-r 表示重启,-h 表示关机断电,时间参数可以是 now(立即),也可以是未来的某个时间。相比直接断电,正常关机会让应用和系统保存状态,各个程序能优雅退出。它在 SSH 和屏幕共享下同样可用,是远程 Mac 界面卡死时的首选处理办法。
03风险
!注意: 关机时打开的应用可能被强制退出,未保存的内容会丢失;注意区分参数:-r 是重启,-h 是彻底关机。
04撤销
✓无需撤销——该命令不会改变持久状态。
05来源
- SHUTDOWN(8) - macOS manual page依据: The manual page contains 'shutdown -r' for rebooting and explains the time argument can be the word 'now' or a future time in yymmddhhmm format.
- shutdown - Shut down or restart the system依据: Documents the shutdown syntax including '-r Reboot the system' and '-h Halt or power off', with time arguments such as 'now'.
最后验证: 2026-09-19 · 分类: 系统与设置