---
title: 2023 年，我的 Mac OS 环境初始化
date: '2023-04-13'
tags: ['Mac OS', '主机', 'Hackintosh', '硬件']
draft: false
summary: 记录和分享我的 Mac OS 必备的基本软件。
---

## 初步环境

跑完系统的向导，正式进入系统后，先装 brew

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

参考：[macOS（或 Linux）缺失的软件包的管理器 — Homebrew](https://brew.sh/index_zh-cn)

### 安装第一批软件

我需要立即能够使用：

- Warp
- Chrome
- Syncthing
- Logseq（现在我抛弃它了，只用来在本地查阅以前记录的内容）

所以：

```bash
brew install --casks warp google-chrome syncthing logseq
```

恢复输入法——小鹤音型
因为使用 Rime 实现的，所以先安装 Squirrel

```bash
brew install --cask squirrel
```

安装完毕后，到系统设置里选择启用鼠须管。

## 开发环境

```bash
brew install --cask visual-studio-code
brew install cmake git-lfs
```

### Node JS 环境

```bash
brew install nvm

cat >> ~/.zshrc<<EOF
#nvm start
export NVM_DIR="$HOME/.nvm"
[ -s "/usr/local/opt/nvm/nvm.sh" ] && \. "/usr/local/opt/nvm/nvm.sh"  # This loads nvm
[ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/usr/local/opt/nvm/etc/bash_completion.d/nvm"  # This loads nvm bash_completion
# nvm end
EOF

source ~/.zshrc

nvm install --lts

npm i -g pnpm && pnpm setup
source /Users/ivan/.zshrc
```

### 数据库运维

```bash
brew tap mongodb/brew
brew install mongodb-database-tools mongosh
```

### Rust

```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

```

### 消息队列

```bash
brew install --casks mqttx
```

### 设计软件

```bash
brew install --casks blender
```

### 硬件开发

```bash
brew install minicom
cargo install cargo-espmonitor
```

### 网络相关

```bash
brew install --cask wireshark
```

## 日常环境

### 软件

```bash
brew install --cask \
telegram-desktop \
iina \
monitorcontrol \
logitech-options \
microsoft-remote-desktop \
keycastr

brew install croc
```

### 终端

#### ZSH 插件

```bash
sh -c "$(curl -fsSL https://git.io/zinit-install)"

echo 'zinit load zsh-users/zsh-syntax-highlighting
zinit load zsh-users/zsh-autosuggestions
zinit load  ael-code/zsh-colored-man-pages
zinit load agkozak/zsh-z
zinit ice depth=1; zinit light romkatv/powerlevel10k' >> ~/.zshrc
```

#### ZSH-Z 配置

避免优先匹配到子目录，在 `.zshrc` 中添加如下行：

```bash
cat >> ~/.zshrc <<EOF

# zsh-z
ZSHZ_UNCOMMON=1
ZSHZ_TRAILING_SLASH=1
EOF
```

#### History 配置

配置历史记录，在 `.zshrc` 中添加如下行：

```bash
cat >> ~/.zshrc <<EOF

# History
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=1000
setopt INC_APPEND_HISTORY_TIME
EOF
```
