关闭 macOS 长按键出拼音/声调弹窗
让长按字母键直接连发(像 Windows 那样),而不是弹出 é、ü 等候选字符。
运行 defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false,然后重启相关应用。
01命令
命令
$ defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false && echo 'Restart the app you want it applied to.'02作用说明
macOS 默认在长按字母键时弹出一排带声调的候选字符,输入法文、德文很方便,但在写代码、玩游戏或终端里按住方向键/删除键时非常碍事。把 ApplePressAndHoldEnabled 设为 false 即可全局恢复经典的按键连发行为。该设置对每个应用在重启后生效,改完请重启对应应用或重新开机。
03风险
!注意: 如果经常输入带声调的外文字符,关闭后就没有这个快捷候选框了。
04撤销
撤销
$ defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool true05来源
- macOS defaults - read, write and delete macOS user defaults依据: Shows `defaults write domain key -bool true/false` as the standard way to write boolean preference keys into NSGlobalDomain or per-app domains.
- macOS setup dotfiles (.macos)依据: Contains the exact line 'defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false' with a comment about the press-and-hold character popup.
最后验证: 2026-09-19 · 分类: 系统与设置