Mac 环境(M1 + Monterey)
Mac 环境(M1 + Monterey)
# Mac 简介
- 视频
- 官方文档
- M1 兼容性相关
# 配置
(如果有其他 Mac 的话用 Time Machine 直接迁移就好)
# Time Machine 恢复后的问题
# 如果网络不正常
- 刚配好丝丝要重启
- 到这里看看删掉与 network 相关的文件,重启:
open /Library/Preferences/SystemConfiguration
# 找到这些文件
com.apple.airport.preferences.plist
com.apple.network.eapolclient.configuration.plist
com.apple.wifi.message-tracer.plist
NetworkInterfaces.plist
preferences.plist
2
3
4
5
6
# 如果是恢复到另一台设备
- 到 Sharing 改电脑名字,重启
- Chrome 用一个新账户重新同步(不然似乎历史记录会识别为同一台设备)
# System Preferences
- Language & Region:英语、简体中文
- Sharing:改电脑名字,重启
- Software Update
- Keyboard:先把 Key Repeat 和 Delay 调到最快
安装 Additional Tools for Xcode (opens new window) 里的 Network Link Conditioner (opens new window)(给电脑限速用的)
(如果装 NTFS 工具等需要 Reduced Security (opens new window))
# dotfiles
.zprofile
.zshrc
.zsh_history
.nrmrc
2
3
4
# 终端配置
sudo 无需密码:
echo -e "\n$USER ALL=(ALL) NOPASSWD: ALL" | sudo tee -a /etc/sudoers
允许安装运行任意软件:
sudo spctl --global-disable
sudo spctl --status
2
bin 目录权限(解决 npm global install 问题):
sudo chown -R $USER /usr/local/bin
复制来的 ssh 私钥要调成只读:
sudo chmod 600 <ssh-file-path>
禁止 PressAndHold(需重启)(解决 这个 VS Code 问题 (opens new window)):
defaults write -g ApplePressAndHoldEnabled -bool false
更快的按键重复(控制面板的 KeyRepeat 最快才到 2)(需重启):
defaults write -g InitialKeyRepeat -int 15
defaults write -g KeyRepeat -int 1
2
提高 Time Machine 的速度(重启后失效,可以做一个 function):
sudo sysctl debug.lowpri_throttle_enabled=0
启用 locate
命令并建立索引:
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
# 安装基本工具
魔法丝袜之影(略)
export ALL_PROXY='http://127.0.0.1:1080'
安装 Xcode Command Line Tools:
xcode-select --install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
(按照提示)激活 brew
命令:
echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> $HOME/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
2
安装一些基本工具(虽然系统自带一些,但是用 brew 来做后续更新):
brew install --formula bat git n scc tig trash tree zsh
brew install --cask google-chrome visual-studio-code iterm2
2
安装 Oh My Zsh (opens new window):
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
安装 更纱黑体 (opens new window)("Sarasa Mono SC"
, "Sarasa Term SC"):
brew tap homebrew/cask-fonts
brew install font-sarasa-gothic
2
安装 Node.js(我用 n 来管理):
sudo n 16
# Finder
- 显示扩展名:
cmd + ,
> Advanced - (剪切功能的快捷键:
cmd + option + v
)
总是显示隐藏文件:
defaults write com.apple.finder AppleShowAllFiles -boolean true; killall Finder
标题显示完整路径:
defaults write com.apple.finder \_FXShowPosixPathInTitle -bool true; killall Finder
Open In Terminal,(装好到 System Preferences > Extensions 开启):
brew install openinterminal
(其他配置略,cmd + ,
、cmd + j
)
# 其他安装的工具
# npm global
npm -g i
- pnpm (opens new window):代替 npm 用
- @antfu/ni (opens new window):自动判断当前的包管理器(npm、yarn、pnpm)
- @types/node (opens new window):node 的类型定义,写 ts 脚本的时候辅助用
- serve (opens new window):读本地文件夹起一个 server(类似 http-server)
- tldr (opens new window):简化的 help 工具(类似 man 或 --help)
- tsno (opens new window):更方便的 ts-node 的代替品,底层是 esbuild
- vercel (opens new window):部署本地 app dist 到 vercel
把全局安装的 @types
软链接到根目录,以便 ts 全局搜索 (opens new window)
mkdir -p ~/node_modules/
ln -s ~/pnpm-global/5/node_modules/@types ~/node_modules/@types
2
# brew
brew install
- bat (opens new window):显示文件内容(类似 cat)
- n (opens new window):Node 版本管理器
- neofetch (opens new window):显示当前环境信息(类似 screenfetch)
- pngquant (opens new window):png 图片压缩
- scc (opens new window):统计代码行数(类似 cloc)
- smartmontools (opens new window):磁盘健康度
- tig (opens new window):更方便的 git history
- trash (opens new window):扔到垃圾桶(用来代替
rm -rf
) - tree (opens new window):显示文件夹树状结构
- you-get (opens new window):视频下载器
# brew cask
brew install --cask
- 开发相关
- docker (opens new window):轻量级虚拟化技术
- switchhosts (opens new window):Host 编辑器
- postman (opens new window):网络请求监听
- 系统增强
- alfred (opens new window):增强版 spotlight
- bettertouchtool (opens new window):快捷键绑定
- hiddenbar (opens new window):菜单栏图标折叠
- karabiner-elements (opens new window):键位映射
- monitorcontrol (opens new window):通过软件直接控制外接显示器硬件亮度
- openinterminal (opens new window):Finder 打开到终端
- unshaky (opens new window):防止按键误触发的工具(解决蝴蝶键盘问题)
- 性能和监控
- cinebench (opens new window):CPU/GPU 性能测试
- coconutbattery (opens new window):电池健康度检查
- daisydisk (opens new window):磁盘空间分析
- istat-menus (opens new window):任务栏硬件监控
- 其他日用
- fliqlo (opens new window):一个翻页时钟屏保
- keka (opens new window):压缩软件
- keycastr (opens new window):显示按键(录屏时用)
- iina (opens new window):视频播放器
- itsycal (opens new window):菜单栏日历
- imazing (opens new window):备份 iPhone 的软件
- telegram-desktop (opens new window):Telegram 桌面客户端
- 网盘/下载
- onedrive (opens new window):One Drive
- megasync (opens new window):Mega Sync,可以排除 node_modules,放一些临时项目用
- thunder (opens new window):迅雷
# App store
- Blackmagic Disk Speed Test (opens new window):磁盘速度测试
- Desktop Clock (opens new window):桌面时钟
- GIPHY CAPTURE (opens new window):截动图/视频工具
- OneNote (opens new window):微软的跨平台笔记
- QQ (opens new window):QQ
- Unsplash Wallpapers (opens new window):Unsplash 随机壁纸
- WeChat (opens new window):微信
- Xcode (opens new window):苹果自家的 IDE
- Xnip (opens new window):截图工具