MacOS 基础配置和常见软件安装
1. 开发工具
Xcode 初始化
第一次使用开发工具,需要安装 Xcode Command Line Tools:
bash
xcode-select --install
安装 Xcode Command Line Tools 后,将自动安装 git
、make
、clang
等开发工具。
安装 Homebrew
下面安装 Homebrew:[1]
将环境变量输出到 ~/.zshrc
:
bash
echo 'export HOMEBREW_API_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api"' >> ~/.zshrc
echo 'export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"' >> ~/.zshrc
echo 'export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"' >> ~/.zshrc
echo 'export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"' >> ~/.zshrc
echo 'export HOMEBREW_PIP_INDEX_URL="https://pypi.tuna.tsinghua.edu.cn/simple"' >> ~/.zshrc
echo 'export HOMEBREW_INSTALL_FROM_API=1' >> ~/.zshrc
然后刷新:
bash
source ~/.zshrc
然后使用镜像安装 Homebrew:
bash
git clone --depth=1 https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/install.git brew-install
/bin/bash brew-install/install.sh
rm -rf brew-install
执行更新,测试安装是否成功:
bash
brew update
安装 Oh My Zsh
可选地,如果需要增强终端的功能,可以安装 Oh My Zsh,下面使用清华镜像安装 Oh My Zsh:[2]
bash
git clone https://mirrors.tuna.tsinghua.edu.cn/git/ohmyzsh.git
cd ohmyzsh/tools
REMOTE=https://mirrors.tuna.tsinghua.edu.cn/git/ohmyzsh.git sh install.sh
安装其他常见开发工具
工具:
bash
brew install git
Docker:
bash
brew install --cask docker
brew install orbstack
注意,可以使用 OrbStack 来代替 Docker Desktop 内置的引擎,以提升性能,此外 OrbStack 还支持运行 Linux 虚拟机,运行 Kubernets 等功能。OrbStack 个人使用免费,商业使用需要购买订阅。
安装后手动打开 OrbStack,然后设置为开机启动。使用如下命令来查看 OrbStack 是否正在运行:
bash
docker version
Context
一栏显示 orbstack
即表示正在使用 OrbStack。
2. 常见依赖安装
编程语言
bash
# C/C++
brew install llvm
brew install clang
# Node.js
brew install nvm
brew install node
brew install deno
# Rust
brew install rust
brew install rustup
# Java
brew install openjdk@8
brew install openjdk@11
brew install openjdk@17
brew install openjdk@21
brew install openjdk@23
brew install maven
# Python
brew install python@3.9
brew install python@3.10
brew install python@3.11
brew install python@3.12
brew install python@3.13
# Ruby
brew install ruby
# Swift
brew install swift
# Kotlin
brew install kotlin
# Scala
brew install scala
# Go
brew install go
# Lua
brew install lua
开发工具
bash
# wget
brew install wget
# 7zip
brew install p7zip
# CMake
brew install cmake
# Docker Desktop
brew install --cask docker
# OrbStack
brew install orbstack
# Postman
brew install --cask postman
# Navicat for MySQL
brew install --cask navicat-for-mysql
IDE & 编辑器
bash
# Visual Studio Code
brew install --cask visual-studio-code
# IntelliJ IDEA
brew install --cask intellij-idea
# WebStorm
brew install --cask webstorm
# PyCharm
brew install --cask pycharm
# CLion
brew install --cask clion
# GoLand
brew install --cask goland
# RustRover
brew install --cask rustrover
中间件
bash
# MySQL
brew install mysql@8.0
brew install mysql@8.4
brew install mysql@9.0
# PostgreSQL
brew install postgresql@12
brew install postgresql@13
brew install postgresql@14
brew install postgresql@15
brew install postgresql@16
brew install postgresql@17
# Nginx
brew install nginx
# Redis
brew install redis
# MongoDB
brew install --cask gcollazo-mongodb
命令行工具
bash
# FFmpeg
brew install ffmpeg
# UV - Python 包管理器
brew install uv
# GitHub CLI
brew install gh
# Ollama
brew install ollama
常用软件
bash
# Google Chrome
brew install --cask google-chrome
# Microsoft Edge
brew install --cask microsoft-edge
# Notion
brew install --cask notion
# Obsidian
brew install --cask obsidian
# 腾讯会议
brew install --cask tencent-meeting
# 飞书
brew install --cask feishu
# OneDrive
brew install --cask onedrive
# OBS Studio
brew install --cask obs
# ToDesk
brew install --cask todesk
# Cherry Studio
brew install --cask cherry-studio
Homebrew / Linuxbrew 镜像使用帮助,清华大学开源软件镜像站,https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/ ↩︎
ohmyzsh Git,清华大学开源软件镜像站,https://mirrors.tuna.tsinghua.edu.cn/help/ohmyzsh.git/ ↩︎