MacOS 系统相关

一、常见问题

1、解决文件已损坏无法打开问题

1
sudo xattr -r -d com.apple.quarantine example.app

2、鼠标跟踪速度调整

设置读取

1
defaults read -g com.apple.mouse.scaling

配置修改

1
defaults write -g com.apple.mouse.scaling 8.0

3、通过 Horizon Client 远程 Windows 时,Ctrl + 鼠标左键失效

进入“Horizon Client -> 偏好设置 -> 键盘和鼠标 -> 鼠标快捷方式”,取消勾选里面的快捷方式选项

二、软件相关

1、Homebrew 安装

项目地址

1
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

2、Mac Brew 国内源设置

原文链接

清华源

1
2
3
4
5
6
7
8
9
10
# 替换brew.git
cd "$(brew --repo)"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

# 替换homebrew-core.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

# 刷新源
brew update

阿里源

1
2
3
4
5
6
7
8
9
10
# 替换brew.git
cd "$(brew --repo)"
git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git

# 替换homebrew-core.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git

# 刷新源
brew update

腾讯源

1
2
3
4
5
6
7
8
9
10
替换brew.git:
cd "$(brew --repo)"
git remote set-url origin https://mirrors.cloud.tencent.com/homebrew/brew.git

替换homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.cloud.tencent.com/homebrew/homebrew-core.git

# 刷新源
brew update

参考资料:

3、Karabiner Elements 配置

配置文件参考

https://github.com/rux616/karabiner-windows-mode

自定义规则

可视化规则编辑器:

https://genesy.github.io/karabiner-complex-rules-generator/

规则备份:

1
{"rules":[{"description":"Ctrl - Toggle input source","manipulators":[{"conditions":[{"bundle_identifiers":["^com\\.apple\\.Terminal","^com\\.omnissa\\.horizon\\.client\\.mac$","^com\\.youqu\\.todesk\\.mac$","^com\\.oray\\.sunlogin\\.macclient$"],"file_paths":[],"type":"frontmost_application_unless"}],"from":{"key_code":"left_control","modifiers":{"optional":["any"]}},"to":[{"key_code":"left_control"}],"to_if_alone":[{"key_code":"caps_lock"}],"parameters":{"basic.to_if_alone_timeout_milliseconds":800},"type":"basic"}]},{"description":"Space (Alt) - Spotlight","manipulators":[{"conditions":[{"bundle_identifiers":[],"file_paths":[],"type":"frontmost_application_unless"}],"from":{"key_code":"spacebar","modifiers":{"mandatory":["option"],"optional":["any"]}},"to":[{"key_code":"spacebar","modifiers":["command"]}],"type":"basic"}]},{"description":"Enter (Ctrl)","manipulators":[{"conditions":[{"bundle_identifiers":["^com\\.apple\\.Terminal","^com\\.omnissa\\.horizon\\.client\\.mac$","^com\\.youqu\\.todesk\\.mac$","^com\\.oray\\.sunlogin\\.macclient$"],"file_paths":[],"type":"frontmost_application_unless"}],"from":{"key_code":"return_or_enter","modifiers":{"mandatory":["control"],"optional":["any"]}},"to":[{"key_code":"return_or_enter","modifiers":["command"]}],"type":"basic"}]},{"description":"Tab (Alt)","manipulators":[{"conditions":[{"bundle_identifiers":["^com\\.apple\\.Terminal","^com\\.omnissa\\.horizon\\.client\\.mac$","^com\\.youqu\\.todesk\\.mac$","^com\\.oray\\.sunlogin\\.macclient$"],"file_paths":[],"type":"frontmost_application_unless"}],"from":{"key_code":"tab","modifiers":{"mandatory":["option"],"optional":["any"]}},"to":[{"key_code":"tab","modifiers":["command"]}],"type":"basic"}]},{"description":"L (Win) - Lock Screen","manipulators":[{"from":{"key_code":"l","modifiers":{"mandatory":["command"],"optional":["any"]}},"to":[{"key_code":"q","modifiers":["control","command"]}],"type":"basic"}]},{"description":"F5 - Only in Chrome","manipulators":[{"conditions":[{"bundle_identifiers":["^com\\.google\\.Chrome$"],"type":"frontmost_application_if"}],"from":{"key_code":"f5","modifiers":{"optional":["any"]}},"to":[{"key_code":"r","modifiers":["command"]}],"type":"basic"}]},{"description":"Delete - Only in Finder","manipulators":[{"conditions":[{"bundle_identifiers":["^com\\.apple\\.finder$"],"type":"frontmost_application_if"}],"from":{"key_code":"delete_forward","modifiers":{"optional":["any"]}},"to":[{"key_code":"delete_or_backspace","modifiers":["left_command"]}],"type":"basic"}]},{"description":"A (Ctrl)","manipulators":[{"conditions":[{"bundle_identifiers":["^com\\.apple\\.Terminal","^com\\.omnissa\\.horizon\\.client\\.mac$","^com\\.youqu\\.todesk\\.mac$","^com\\.oray\\.sunlogin\\.macclient$"],"file_paths":[],"type":"frontmost_application_unless"}],"from":{"key_code":"a","modifiers":{"mandatory":["control"],"optional":["any"]}},"to":[{"key_code":"a","modifiers":["command"]}],"type":"basic"}]},{"description":"B (Ctrl)","manipulators":[{"conditions":[{"bundle_identifiers":["^com\\.apple\\.Terminal","^com\\.omnissa\\.horizon\\.client\\.mac$","^com\\.youqu\\.todesk\\.mac$","^com\\.oray\\.sunlogin\\.macclient$"],"file_paths":[],"type":"frontmost_application_unless"}],"from":{"key_code":"b","modifiers":{"mandatory":["control"],"optional":["any"]}},"to":[{"key_code":"b","modifiers":["command"]}],"type":"basic"}]},{"description":"C (Ctrl)","manipulators":[{"conditions":[{"bundle_identifiers":["^com\\.apple\\.Terminal","^com\\.omnissa\\.horizon\\.client\\.mac$","^com\\.youqu\\.todesk\\.mac$","^com\\.oray\\.sunlogin\\.macclient$"],"file_paths":[],"type":"frontmost_application_unless"}],"from":{"key_code":"c","modifiers":{"mandatory":["left_control"],"optional":["any"]}},"to":[{"key_code":"c","modifiers":["command"]}],"type":"basic"}]},{"description":"F (Ctrl)","manipulators":[{"conditions":[{"bundle_identifiers":["^com\\.apple\\.Terminal","^com\\.omnissa\\.horizon\\.client\\.mac$","^com\\.youqu\\.todesk\\.mac$","^com\\.oray\\.sunlogin\\.macclient$"],"file_paths":[],"type":"frontmost_application_unless"}],"from":{"key_code":"f","modifiers":{"mandatory":["control"],"optional":["any"]}},"to":[{"key_code":"f","modifiers":["command"]}],"type":"basic"}]},{"description":"I (Ctrl)","manipulators":[{"conditions":[{"bundle_identifiers":["^com\\.apple\\.Terminal","^com\\.omnissa\\.horizon\\.client\\.mac$","^com\\.youqu\\.todesk\\.mac$","^com\\.oray\\.sunlogin\\.macclient$"],"file_paths":[],"type":"frontmost_application_unless"}],"from":{"key_code":"i","modifiers":{"mandatory":["control"],"optional":["any"]}},"to":[{"key_code":"i","modifiers":["command"]}],"type":"basic"}]},{"description":"N (Ctrl)","manipulators":[{"conditions":[{"bundle_identifiers":["^com\\.apple\\.Terminal","^com\\.omnissa\\.horizon\\.client\\.mac$","^com\\.youqu\\.todesk\\.mac$","^com\\.oray\\.sunlogin\\.macclient$"],"file_paths":[],"type":"frontmost_application_unless"}],"from":{"key_code":"n","modifiers":{"mandatory":["control"],"optional":["any"]}},"to":[{"key_code":"n","modifiers":["command"]}],"type":"basic"}]},{"description":"O (Ctrl)","manipulators":[{"conditions":[{"bundle_identifiers":["^com\\.apple\\.Terminal","^com\\.omnissa\\.horizon\\.client\\.mac$","^com\\.youqu\\.todesk\\.mac$","^com\\.oray\\.sunlogin\\.macclient$"],"file_paths":[],"type":"frontmost_application_unless"}],"from":{"key_code":"o","modifiers":{"mandatory":["control"],"optional":["any"]}},"to":[{"key_code":"o","modifiers":["command"]}],"type":"basic"}]},{"description":"P (Ctrl)","manipulators":[{"conditions":[{"bundle_identifiers":["^com\\.apple\\.Terminal","^com\\.omnissa\\.horizon\\.client\\.mac$","^com\\.youqu\\.todesk\\.mac$","^com\\.oray\\.sunlogin\\.macclient$"],"file_paths":[],"type":"frontmost_application_unless"}],"from":{"key_code":"p","modifiers":{"mandatory":["control"],"optional":["any"]}},"to":[{"key_code":"p","modifiers":["command"]}],"type":"basic"}]},{"description":"R (Ctrl)","manipulators":[{"conditions":[{"bundle_identifiers":["^com\\.apple\\.Terminal","^com\\.omnissa\\.horizon\\.client\\.mac$","^com\\.youqu\\.todesk\\.mac$","^com\\.oray\\.sunlogin\\.macclient$"],"file_paths":[],"type":"frontmost_application_unless"}],"from":{"key_code":"r","modifiers":{"mandatory":["control"],"optional":["any"]}},"to":[{"key_code":"r","modifiers":["command"]}],"type":"basic"}]},{"description":"S (Ctrl)","manipulators":[{"conditions":[{"bundle_identifiers":["^com\\.apple\\.Terminal","^com\\.omnissa\\.horizon\\.client\\.mac$","^com\\.youqu\\.todesk\\.mac$","^com\\.oray\\.sunlogin\\.macclient$"],"file_paths":[],"type":"frontmost_application_unless"}],"from":{"key_code":"s","modifiers":{"mandatory":["control"],"optional":["any"]}},"to":[{"key_code":"s","modifiers":["command"]}],"type":"basic"}]},{"description":"T (Ctrl)","manipulators":[{"conditions":[{"bundle_identifiers":["^com\\.apple\\.Terminal","^com\\.omnissa\\.horizon\\.client\\.mac$","^com\\.youqu\\.todesk\\.mac$","^com\\.oray\\.sunlogin\\.macclient$"],"file_paths":[],"type":"frontmost_application_unless"}],"from":{"key_code":"t","modifiers":{"mandatory":["control"],"optional":["any"]}},"to":[{"key_code":"t","modifiers":["command"]}],"type":"basic"}]},{"description":"U (Ctrl)","manipulators":[{"conditions":[{"bundle_identifiers":["^com\\.apple\\.Terminal","^com\\.omnissa\\.horizon\\.client\\.mac$","^com\\.youqu\\.todesk\\.mac$","^com\\.oray\\.sunlogin\\.macclient$"],"file_paths":[],"type":"frontmost_application_unless"}],"from":{"key_code":"u","modifiers":{"mandatory":["control"],"optional":["any"]}},"to":[{"key_code":"u","modifiers":["command"]}],"type":"basic"}]},{"description":"V (Ctrl)","manipulators":[{"conditions":[{"bundle_identifiers":["^com\\.apple\\.Terminal","^com\\.omnissa\\.horizon\\.client\\.mac$","^com\\.youqu\\.todesk\\.mac$","^com\\.oray\\.sunlogin\\.macclient$"],"file_paths":[],"type":"frontmost_application_unless"}],"from":{"key_code":"v","modifiers":{"mandatory":["control"],"optional":["any"]}},"to":[{"key_code":"v","modifiers":["command"]}],"type":"basic"}]},{"description":"W (Ctrl)","manipulators":[{"conditions":[{"bundle_identifiers":["^com\\.apple\\.Terminal","^com\\.omnissa\\.horizon\\.client\\.mac$","^com\\.youqu\\.todesk\\.mac$","^com\\.oray\\.sunlogin\\.macclient$"],"file_paths":[],"type":"frontmost_application_unless"}],"from":{"key_code":"w","modifiers":{"mandatory":["control"],"optional":["any"]}},"to":[{"key_code":"w","modifiers":["command"]}],"type":"basic"}]},{"description":"X (Ctrl)","manipulators":[{"conditions":[{"bundle_identifiers":["^com\\.apple\\.Terminal","^com\\.omnissa\\.horizon\\.client\\.mac$","^com\\.youqu\\.todesk\\.mac$","^com\\.oray\\.sunlogin\\.macclient$"],"file_paths":[],"type":"frontmost_application_unless"}],"from":{"key_code":"x","modifiers":{"mandatory":["control"],"optional":["any"]}},"to":[{"key_code":"x","modifiers":["command"]}],"type":"basic"}]},{"description":"Y (Ctrl)","manipulators":[{"conditions":[{"bundle_identifiers":["^com\\.apple\\.Terminal","^com\\.omnissa\\.horizon\\.client\\.mac$","^com\\.youqu\\.todesk\\.mac$","^com\\.oray\\.sunlogin\\.macclient$"],"file_paths":[],"type":"frontmost_application_unless"}],"from":{"key_code":"y","modifiers":{"mandatory":["control"],"optional":["any"]}},"to":[{"key_code":"y","modifiers":["command"]}],"type":"basic"}]},{"description":"Z (Ctrl)","manipulators":[{"conditions":[{"bundle_identifiers":["^com\\.apple\\.Terminal","^com\\.omnissa\\.horizon\\.client\\.mac$","^com\\.youqu\\.todesk\\.mac$","^com\\.oray\\.sunlogin\\.macclient$"],"file_paths":[],"type":"frontmost_application_unless"}],"from":{"key_code":"z","modifiers":{"mandatory":["control"],"optional":["any"]}},"to":[{"key_code":"z","modifiers":["command"]}],"type":"basic"}]}],"title":"Welearn Custom Rules"}

披量导入规则

  1. 编辑并保存规则文件:ke-rule.json

  2. 在规则文件所在目录启动 HTTP 服务:python3 -m http.server

  3. 浏览器访问该链接:karabiner://karabiner/assets/complex_modifications/import?url=http://localhost:8000/ke-rule.json

评论