神奇魔法:让 Mac 只保留一个输入法
自从 Mac 升级到 Ventura 系统之后,系统自带的中文输入法会偶尔卡死系统,导致所有 app 都无法使用。要么重启系统,要么杀掉系统简体中文输入法进程来解决问题。但不管是哪种解决方式,都让人不爽。索性干脆直接替换掉 Mac 自带的输入法。我这里就下载安装了微信输入法 Mac 版,但是在配置输入法时,默认的系统输入法 ABC 始终无法删除掉。经过一番 Google,这才有了解决方案。所以在此篇博文做个记录。
操作步骤
1. 备份 com.apple.HIToolbox.plist 文件
cp ~/Library/Preferences/com.apple.HIToolbox.plist{,_1}
会拷贝 ~/Library/Preferences/com.apple.HIToolbox.plist
文件到同目录下的 ~/Library/Preferences/com.apple.HIToolbox.plist_1
。
2. 将当前活跃输入法选为「英文」输入法
3. 转换 plist 文件为 xml 格式
plutil -convert xml1 ~/Library/Preferences/com.apple.HIToolbox.plist
因为 plist 有两种格式,一种是二进制的,直接用编辑器打开是乱码,所以需要用工具转为 xml 格式,方便编辑。
4. 修改 com.apple.HIToolbox.plist 文件
用编辑器打开 com.apple.HIToolbox.plist
,删除掉 AppleEnabledInputSources 键下不需要的输入法dict。可以不用拷贝,直接编辑系统上的文件到类似的内容即可,然后保存文件。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AppleCapsLockPressAndHoldToggleOff</key>
<false/>
<key>AppleCurrentKeyboardLayoutInputSourceID</key>
<string>com.apple.keylayout.US</string>
<key>AppleEnabledInputSources</key>
<array>
<dict>
<key>Bundle ID</key>
<string>com.apple.CharacterPaletteIM</string>
<key>InputSourceKind</key>
<string>Non Keyboard Input Method</string>
</dict>
</array>
<key>AppleInputSourceHistory</key>
<array>
<dict>
<key>Bundle ID</key>
<string>com.tencent.inputmethod.wetype</string>
<key>Input Mode</key>
<string>com.tencent.inputmethod.wetype.pinyin</string>
<key>InputSourceKind</key>
<string>Input Mode</string>
</dict>
</array>
<key>AppleSelectedInputSources</key>
<array>
<dict>
<key>Bundle ID</key>
<string>com.apple.PressAndHold</string>
<key>InputSourceKind</key>
<string>Non Keyboard Input Method</string>
</dict>
<dict>
<key>Bundle ID</key>
<string>com.tencent.inputmethod.wetype</string>
<key>Input Mode</key>
<string>com.tencent.inputmethod.wetype.pinyin</string>
<key>InputSourceKind</key>
<string>Input Mode</string>
</dict>
</array>
</dict>
</plist>
5. 重启系统
保存文件后,直接重启 Mac 系统。启动后就会发现菜单栏只剩下一个微信输入法了。