全局关闭 macOS 自动纠错与自动大写

通过 NSGlobalDomain 的键一次性关掉拼写纠正、句首自动大写和双空格变句号。

macOSmacOSdefaults 偏好设置键盘中风险
运行 defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false 等三条命令,然后重启正在使用的应用。

01命令

命令
$ defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false && defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false && defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false

02作用说明

这些 NSAutomatic* 键对应系统设置 > 键盘 > 文本输入里的开关;写入全局域相当于给所有遵循该设置的应用改默认值,包括那些根本找不到单独开关的应用。应用在启动时读取该值,所以修改后要重启相关应用。对开发者尤其实用——代码、URL 和中英混排文本不会再被“自动纠正”得面目全非。

03风险

风险中风险

04撤销

撤销
$ defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool true && defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool true && defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool true

05来源

  • macOS defaults - read, write and delete macOS user defaults
    SS64 · technical · 2026-09-17
    依据: Documents `defaults write NSGlobalDomain key -bool value` for boolean global preference keys, the mechanism used by apps that read NSAutomatic* flags.
  • macOS setup dotfiles (.macos)
    mathiasbynens/dotfiles (GitHub) · community · 2026-09-17
    依据: Contains 'defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false' and adjacent NSAutomaticCapitalizationEnabled / NSAutomaticPeriodSubstitutionEnabled / NSAutomaticDashSubstitutionEnabled lines to disable smart text features globally.

最后验证: 2026-09-19 · 分类: 系统与设置

06相关方案