用 displayplacer 在终端里改 Mac 分辨率、排列显示器
使用 displayplacer 命令行工具查看屏幕 ID 和可用分辨率,一键修改分辨率、旋转屏幕、设置主显示器、调整多显示器排列。
先用 `brew install displayplacer` 安装,再运行 `displayplacer list` 查看屏幕 ID 和可用分辨率,然后执行例如 `displayplacer "id:<screenId> res:<宽>x<高> origin:(<x>,<y>) degree:0"` 即可生效。位于 origin (0,0) 的屏幕会成为主显示器。
01命令
命令
$ brew install displayplacer && displayplacer list02作用说明
displayplacer 是一款 macOS 命令行显示器配置工具,相当于 macOS 版的 XRandR。先运行 `displayplacer list` 查看当前屏幕信息和可选分辨率,同时它会打印当前布局的参数,方便你保存成脚本或快捷键配置文件。然后应用配置:可设置 res(分辨率)、hz(刷新率)、color_depth(色深,均可选,省略时自动选最高)、scaling、origin(位置)和 degree(旋转角度 0/90/180/270)。要开启镜像,可以把 ID 写成 `id:<主屏Id>+<副屏Id>`。还可以用 `mode:<modeNum>` 指定模式、用 `enabled:false` 关闭某块屏幕,或旋转 MacBook 内置屏。注意外接显示器唤醒顺序不稳定时 screenId 有时会变,工具提供持久型、上下文型、序列号型三种 ID,可以混搭使用。
03风险
!注意: displayplacer list 列出的部分分辨率实际不可用,选中后工具会自动退回一个可用的分辨率;另外被禁用的屏幕可能需要重新插拔才能恢复。
04撤销
撤销
$ Run `displayplacer list` before changing anything and re-apply the saved args later, e.g. displayplacer "id:<screenId> res:<width>x<height> hz:<num> color_depth:<num> scaling:<on/off> origin:(<x>,<y>) degree:<0/90/180/270>"05来源
- GitHub - jakehilborn/displayplacer: macOS command line utility to configure multi-display resolutions and arrangements. Essentially XRandR for macOS. · GitHub依据: Install via Homebrew with brew install displayplacer or visit the releases tab.
最后验证: 2026-09-21 · 分类: 系统与设置