工欲善其事,必先利其器。一个好用的开发环境能大大提升效率。这篇文章记录我在macOS上的开发环境配置,持续更新中...
必备软件
1. Homebrew
macOS上最方便的包管理器:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
2. iTerm2 + Oh My Zsh
比系统终端更好用的终端:
# 安装Oh My Zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# 安装插件
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
3. VS Code
我最喜欢的代码编辑器:
brew install --cask visual-studio-code
4. Docker
容器化开发环境:
brew install --cask docker
编程语言环境
Python
推荐使用pyenv管理Python版本:
brew install pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
# 安装Python
pyenv install 3.11.0
pyenv global 3.11.0
Node.js
使用nvm管理Node版本:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
nvm install 20
nvm use 20
Go
brew install go
效率工具
- Raycast:比Spotlight更强大的启动器
- Alfred:老牌效率工具
- Karabiner-Elements:键盘映射
- Arc:浏览器
我的VS Code配置
推荐安装的扩展:
- GitLens - Git增强
- Prettier - 代码格式化
- ESLint - JS代码检查
- Python - Python支持
- Material Icon Theme - 图标主题
结语
开发环境的配置是一个持续的过程,随着使用经验的积累,我会不断优化我的配置。如果你也有什么好用的工具推荐,欢迎告诉我!