Skip to content

Instantly share code, notes, and snippets.

@maboloshi
Last active June 27, 2023 02:37
Show Gist options
  • Save maboloshi/5cda4be7e6fac61a1cfa2c7a66375f16 to your computer and use it in GitHub Desktop.
Save maboloshi/5cda4be7e6fac61a1cfa2c7a66375f16 to your computer and use it in GitHub Desktop.
[mac 删除默认ABC输入法] mac默认ABC输入法,默认无法使用“系统偏好与设置”中删除。需要运行本脚本,运行后立即重启系统。生效修改
#!/bin/bash
cd ~/Library/Preferences/
cp com.apple.HIToolbox.plist com.apple.HIToolbox.plist.bak
alias plistbuddy='/usr/libexec/PlistBuddy'
dict=$(plistbuddy -c "Print AppleEnabledInputSources" com.apple.HIToolbox.plist| grep -c "Dict")
for i in {0..$dict};do
if [ "$(plistbuddy -c "Print AppleEnabledInputSources:$i:KeyboardLayout\ Name" com.apple.HIToolbox.plist 2>/dev/null)" = "ABC" ]
then
plistbuddy -c "Delete :AppleEnabledInputSources:$i" com.apple.HIToolbox.plist;
return;
fi
done;
@maboloshi
Copy link
Author

``与#( )同效

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment