init-my-macbook

初始化我的 MacBook

GitHub Website License

这个文档的目的是每次拿到新的 MacBook 时,方便快速初始化笔记本,安装必备工具并记录必要的配置。也是想收集大家平时好用的软件,及时体验上新的好工具

🔗 相关链接

如何贡献这个文档

建议通过 Issue 或 Pull Request 提交修改。合并前我会逐一验证每个软件的安装与使用。对于功能重叠或类型相近的软件,我会在文档中合并对比,并给出推荐项。建议在 PR 中附上变更说明、测试环境与必要截图。

1. 📦 软件安装

1. Homebrew(包管理器)

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew --version

官网地址: https://brew.sh/zh-cn/

2. 配置 github

# 1. 生成新的 SSH 密钥对
ssh-keygen -t ed25519 -C "your-email@example.com"

# 2. 查看公钥内容
cat ~/.ssh/id_ed25519.pub

# 3. 配置 github
	# 1. 复制公钥内容
	# 2. 登录 GitHub → Settings → SSH and GPG keys
	# 3. 点击 "New SSH key"
	# 4. 粘贴公钥并保存

# 4. 配置 Git 身份信息(全局)
git config --global user.email "you@example.com"
git config --global user.name "Your Name"

# 5. 仅为当前仓库配置
git config user.email "you@example.com"
git config user.name "Your Name"

3. iTerm2

brew install --cask iterm2

设置为默认终端:

3.1 Oh My Zsh

# 安装 Oh My Zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

3.2 Dracula 主题

# 下载主题仓库
git clone https://github.com/dracula/iterm.git

安装步骤: https://draculatheme.com/iterm

  1. iTerm2 > settings > Profiles > Colors Tab;
  2. Open the Color Presets… drop-down in the bottom right corner;
  3. Select Import… from the list;
  4. Select the Dracula.itermcolors file;
  5. Select the Dracula from Color Presets…. 💜
  6. 删除仓库

3.3 zsh-autosuggestions(命令自动补全建议插件)

brew install zsh-autosuggestions
plugins=(git zsh-autosuggestions)

验证是否生效:打开新终端,输入部分命令应出现灰色联想;或执行

grep -n "zsh-autosuggestions.zsh" ~/.zshrc

3.4 zsh-syntax-highlighting(语法高亮插件)

brew install zsh-syntax-highlighting
echo 'source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh' >> ~/.zshrc

source ~/.zshrc

4. Visual Studio Code

brew install --cask visual-studio-code

安装 code 命令:

  1. 打开命令面板:Cmd + Shift + P
  2. 输入 shell command
  3. 选择并运行:Shell Command: Install 'code' command in PATH

5. Cursor

brew install --cask cursor

导入 VS Code 配置:首选项 → Cursor Setting → Import Settings from VS Code

  1. # 找到 cursor 程序下 product.json
    code /Applications/Cursor.app/Contents/Resources/app/product.json
    
  2. 找到 extensionsGallery,将其中 https://marketplace.cursorapi.com 改成 https://marketplace.visualstudio.com

  3. 重启,重新导入就可以了,记得还原文件

6. Markdown 编辑器

7. QQ、WeChat、腾讯会议

brew install --cask wechat qq tencent-meeting

⚠️ 记得修改存储路径

8. Mos(鼠标滚动方向调整)

brew install --cask mos

9. 谷歌浏览器

brew install --cask google-chrome

10. 有道词典

brew install --cask youdaodict

11. Snipaste(截图工具)

brew install --cask snipaste

12. 系统清理

13. 网易云音乐

brew install --cask neteasemusic

14. 右键工具

15.1 超级右键

下载地址: https://macked.app/irightmouse-pro-crack.html

⚠️ 将 Cursor 添加到右键菜单

15.2 easy new file

15. Whistle

16. DBeaver

# 安装社区版
brew install --cask dbeaver-community

17. Clash Verge 系统代理工具

2. 🚀 Node.js 环境配置

1. 安装包管理工具

# 安装 nrm(npm 源管理)
npm install nrm -g

# 安装 pnpm(快速包管理器)
npm install pnpm -g

# ARM Mac 需要安装 Rosetta 以支持低版本 Node
/usr/sbin/softwareupdate --install-rosetta --agree-to-license

2. FNM(Node.js 版本管理)

brew install fnm

配置 FNM:

  1. 编辑配置文件:code ~/.zshrc

  2. 添加以下配置:

    # fnm 配置
    eval "$(fnm env --use-on-cd)"
    
  3. 重新加载配置:source ~/.zshrc

  4. 设置默认版本:fnm default <版本号>

处理 arm 版本 mac 低版本 node

# 安装 Rosetta 2
softwareupdate --install-rosetta

# 同意许可协议
softwareupdate --install-rosetta --agree-to-license

高版本启动yarn pnpm

corepack enable

3. Docker

1. Docker DeskTop