Setup Mac cho vibe coding với nhiều AI agent A Mac setup for vibe coding with many AI agents
Đúng bộ công cụ đang dùng hằng ngày: Claude Code, Codex, Gemini CLI, Amp và omp chạy song song trong Orca, đi qua gateway OmniRoute, trên Ghostty + zellij, điều khiển được cả từ điện thoại. The exact daily toolkit: Claude Code, Codex, Gemini CLI, Amp and omp running in parallel in Orca, routed through OmniRoute, on Ghostty + zellij, reachable from a phone.
Bắt đầu nhanh trên máy mớiQuick start on a new Mac
7 bước, chạy theo thứ tự. Các mục bên dưới giải thích từng bước.Seven steps, in order. The sections below explain each one.
# 1. Xcode Command Line Tools + Homebrew
xcode-select --install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# 2. Clone the repo and install the whole stack
git clone https://github.com/novahoangdev/mac-dev-setup.git ~/mac-dev-setup
cd ~/mac-dev-setup && brew bundle --file=Brewfile
# 3. Claude Code (native installer, auto-updates)
curl -fsSL https://claude.ai/install.sh | bash
# 4. Restore macOS settings exported from the old Mac
bash backups/apply-my-settings.sh
# 5. Oh My Zsh + ~/.zshrc (section 02), then open a new terminal tab
mkdir -p ~/.nvm
# 6. Node + pnpm + OmniRoute
nvm install 26 && nvm alias default 26 && npm i -g pnpm omniroute
# 7. Verify
bash scripts/verify-setup.shmacOS & sao lưu settingmacOS & settings backup
Không chỉnh tay lại từ đầu: xuất setting máy cũ thành script, chạy trên máy mới.Never re-tweak by hand: export the old Mac's settings to a script and run it on the new one.
Setting đang dùngCurrent settings
| NhómArea | Giá trịValue |
|---|---|
| Bàn phímKeyboard | KeyRepeat 2 · InitialKeyRepeat 15 · tắt giữ phím hiện dấu, tắt tự sửa chính tả/viết hoa/dấu chấmno press-and-hold, no autocorrect/capitalize/period |
| Trackpad | Chạm để click, kéo 3 ngón, vuốt 4 ngón đổi Space/Mission Control, tốc độ 3.0Tap to click, 3-finger drag, 4-finger swipes for Spaces/Mission Control, speed 3.0 |
| Finder | Path bar, status bar, thư mục lên đầu, hiện mọi đuôi file, không tạo .DS_Store trên ổ mạng/USBPath bar, status bar, folders first, all extensions, no .DS_Store on network/USB |
| Dock | Size 37, ẩn app gần đâySize 37, no recent apps |
Trên máy cũ: xuất settingOld Mac: export
Chỉ đọc (defaults read), ghi ra backups/apply-my-settings.sh. Mặc định in tiếng Anh, thêm --vi để in tiếng Việt.Read-only (defaults read); writes backups/apply-my-settings.sh. Output is English by default; pass --vi for Vietnamese.
bash scripts/export-macos-settings.shTrên máy mới: khôi phụcNew Mac: restore
Ghi lại setting rồi khởi động lại Finder/Dock. Trackpad cần đăng xuất một lần.Writes the settings and restarts Finder/Dock. Trackpad needs one logout.
bash backups/apply-my-settings.shZsh, Oh My Zsh & CLI
Oh My Zsh + Powerlevel10k, gợi ý lệnh, tô màu cú pháp và bộ CLI thay thế lệnh Unix cũ.Oh My Zsh + Powerlevel10k, autosuggestions, syntax highlighting and modern replacements for classic Unix tools.
Cài Oh My Zsh, theme và pluginInstall Oh My Zsh, theme and plugins
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
ZC=${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git $ZC/themes/powerlevel10k
git clone https://github.com/zsh-users/zsh-autosuggestions $ZC/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting $ZC/plugins/zsh-syntax-highlightingPhần lõi của ~/.zshrcCore of ~/.zshrc
nvm được lazy-load để mở tab nhanh, nhưng Node mặc định vẫn có sẵn trong PATH cho script và agent. Mọi API key nằm trong ~/.zsh_secrets (chmod 600), không bao giờ viết thẳng vào .zshrc.nvm is lazy-loaded for fast tabs, while the default Node stays on PATH for scripts and agents. All API keys live in ~/.zsh_secrets (chmod 600), never inline in .zshrc.
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="powerlevel10k/powerlevel10k"
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
source $ZSH/oh-my-zsh.sh
[[ -f ~/.p10k.zsh ]] && source ~/.p10k.zsh
typeset -U path
export BUN_INSTALL="$HOME/.bun"
export PATH="$HOME/.local/bin:$BUN_INSTALL/bin:$PATH"
# nvm: default Node on PATH now, full nvm only when called
export NVM_DIR="$HOME/.nvm"
_nvm_bin=(${~:-$NVM_DIR/versions/node/v$(<$NVM_DIR/alias/default 2>/dev/null)*/bin}(N-/nOn[1]))
(( ${#_nvm_bin} )) && export PATH="$_nvm_bin[1]:$PATH"; unset _nvm_bin
nvm() { unset -f nvm; source "$(brew --prefix nvm)/nvm.sh"; nvm "$@"; }
# secrets (API keys) — chmod 600, never committed
[ -r ~/.zsh_secrets ] && source ~/.zsh_secrets
# modern CLI
alias ls="eza --icons --git --group-directories-first"
alias ll="eza -la --icons --git --group-directories-first"
alias tree="eza --tree --icons"
alias cat="bat --style=plain"
alias lg="lazygit"
eval "$(zoxide init zsh)"
alias cd="z"touch ~/.zsh_secrets && chmod 600 ~/.zsh_secretsBộ CLI trong BrewfileCLI tools in the Brewfile
| Tool | Thay choReplaces | Dùng đểUsed for |
|---|---|---|
| eza | ls | Icon, trạng thái git, xem cây thư mụcIcons, git status, tree view |
| bat | cat | Tô màu cú phápSyntax highlighting |
| ripgrep | grep | Tìm code nhanh, tôn trọng .gitignore (agent cũng dùng)Fast code search that respects .gitignore (agents use it too) |
| zoxide | cd | z tên-dự-án nhảy thẳng tới thư mục hay dùngz project jumps to frequent folders |
| gh | — | PR, issue, CI ngay trong terminal; agent dùng để mở PRPRs, issues, CI from the terminal; agents use it to open PRs |
| lazygit · delta | git UI · diff | Review diff của agent nhanh và dễ đọcReview agent diffs quickly and readably |
Runtime & DockerRuntimes & Docker
Node qua nvm, pnpm/bun cho JS, uv cho Python, Docker Desktop cho container.Node via nvm, pnpm/bun for JS, uv for Python, Docker Desktop for containers.
Node · pnpm · bun
nvm install 26 && nvm alias default 26
npm i -g pnpm
bun --versionDự án cũ cần Node khác: nvm use 16 trong thư mục đó (hoặc file .nvmrc).Legacy projects: nvm use 16 in that folder (or an .nvmrc).
Python · uv
uv python install 3.12
uv init my-app && cd my-app && uv add fastapi
uv tool install ruff # global CLI toolDocker Desktop
Cài qua Brewfile (docker-desktop). Mở app một lần để cấp quyền, sau đó docker và docker compose dùng được trong terminal. Mobile (iOS/Android) dùng thêm Xcode từ App Store và phần tuỳ chọn cuối Brewfile.Installed via the Brewfile (docker-desktop). Open it once to grant permissions; then docker and docker compose work in the terminal. For mobile (iOS/Android), add Xcode from the App Store and the optional block at the end of the Brewfile.
AI agent & gatewayAI agents & gateway
Nhiều agent CLI, mỗi con một vai; chung một bộ luật trong repo; model đi qua OmniRoute khi cần.Several CLI agents with distinct roles, one shared rule set per repo, models routed through OmniRoute when needed.
Ai làm gìWho does what
| Agent | CàiInstall | Vai tròRole |
|---|---|---|
| Claude Code | curl -fsSL https://claude.ai/install.sh | bash | Agent chính: làm task end-to-end, skills, hooks, subagentMain agent: end-to-end tasks, skills, hooks, subagents |
| Codex | brew install --cask codex | Agent thứ hai: review chéo, làm task song songSecond agent: cross-review, parallel tasks |
| Gemini CLI | brew install gemini-cli | Đọc codebase lớn, hỏi nhanhLarge-codebase reading, quick questions |
| Amp | brew install ampcode/tap/ampcode | Agent bổ sung cho task dàiExtra agent for long-running tasks |
| omp | brew install can1357/tap/omp | Harness chạy được mọi model qua OmniRoute (alias o, ai)Harness that runs any model via OmniRoute (aliases o, ai) |
# first-time login
claude # then /login
codex login
gemini # pick Login with Google
amp loginOmniRoute — một endpoint cho mọi modelOmniRoute — one endpoint for every model
Gateway chuẩn OpenAI chạy local ở http://localhost:20128/v1: gom nhiều provider, tự fallback khi một model lỗi/hết quota. Tool nào nhận OPENAI_BASE_URL đều dùng được. Gateway nhìn thấy toàn bộ prompt và giữ key provider, nên chỉ chạy local.An OpenAI-compatible gateway at http://localhost:20128/v1: many providers behind one endpoint with automatic fallback. Any tool that honours OPENAI_BASE_URL can use it. It sees every prompt and holds provider keys, so keep it local.
npm i -g omniroute
omniroute # open the dashboard, add providers, create an API key# ~/.zsh_secrets
export OMNIROUTE_API_KEY="..."
# ~/.zshrc
alias om='nvm use 26 && omniroute'
alias oms='omniroute stop'
alias o='omp'
omp-omni() {
OPENAI_API_KEY="$OMNIROUTE_API_KEY" \
OPENAI_BASE_URL="http://localhost:20128/v1" \
omp --model "${1:-antigravity/gemini-3.7-flash-low}"
}Một bộ luật cho mọi agentOne rule set for every agent
AGENTS.md là nguồn chuẩn (Codex, Amp, Gemini, omp đọc trực tiếp). CLAUDE.md chỉ import nó. Skill dùng chung đặt ở .agents/skills/ và symlink sang .claude/skills/.AGENTS.md is the source of truth (Codex, Amp, Gemini and omp read it directly). CLAUDE.md just imports it. Shared skills live in .agents/skills/, symlinked into .claude/skills/.
my-repo/
├── AGENTS.md # shared rules: fast path, verify, git safety
├── CLAUDE.md # contains only: @AGENTS.md
├── .agents/skills/ # shared skills
└── .claude/skills -> ../.agents/skillsprintf '@AGENTS.md\n' > CLAUDE.md
mkdir -p .agents/skills .claude && ln -s ../.agents/skills .claude/skillsDesktop & giọng nóiDesktop & voice
- • Claude Desktop / ChatGPT — hỏi nhanh, đọc tài liệu, phác thảo spec trước khi giao cho agent.quick questions, reading docs, drafting specs before handing to an agent.
- • Wispr Flow — đọc prompt bằng giọng nói vào bất kỳ ô nhập nào; prompt dài và đủ ngữ cảnh hơn gõ tay.dictate prompts into any input; longer, richer prompts than typing.
Chạy song song & điều khiển từ xaParallel agents & remote control
Mỗi agent một git worktree để không giẫm chân nhau; theo dõi và duyệt quyền từ điện thoại.Each agent gets its own git worktree so they never collide; monitor and approve from a phone.
Orca
Desktop app chạy nhiều agent CLI song song, mỗi agent trong một worktree riêng; xem PR/issue và mở worktree từ task ngay trong app. Agent có thể tự tạo worktree qua CLI orca.Desktop app that runs many CLI agents in parallel, each in its own worktree; browse PRs/issues and open a worktree from a task in-app. Agents can script it with the orca CLI.
brew install --cask stablyai/orca/orca
orca --helpLưu ý: cask orca trần trong Homebrew là tool khác của plotly — luôn dùng stablyai/orca/orca.Note: the bare orca cask in Homebrew is an unrelated plotly tool — always use stablyai/orca/orca.
Worktree thủ côngManual worktrees
# ~/.zshrc — gw-add feat-x → ../repo-feat-x
gw-add() {
local dir="../$(basename "$PWD")-$1"
git worktree add "$dir" -b "$1" && cd "$dir"
}git worktree list
git worktree remove ../repo-feat-xzellij
Session sống sót khi đóng terminal hoặc mất mạng — agent vẫn chạy, quay lại attach là thấy.Sessions survive closing the terminal or dropping the network — agents keep running; re-attach to pick up.
alias zz="zellij"
alias zza="zellij attach -c" # attach or create
alias zzl="zellij ls"
alias zzk="zellij kill-session"Từ điện thoại: Tailscale + mosh + MoshiFrom a phone: Tailscale + mosh + Moshi
Tailscale tạo mạng riêng tới Mac (không mở port ra internet), mosh giữ kết nối khi đổi Wi-Fi/4G, moshi-hook đẩy yêu cầu duyệt quyền của agent về app Moshi trên điện thoại.Tailscale gives a private network to the Mac (no public ports), mosh survives Wi-Fi/cellular switches, and moshi-hook forwards agent permission prompts to the Moshi phone app.
sudo tailscale up
moshi-hook host setup # enable SSH/mosh on the Mac
moshi-hook pair --token <pairing-token>
moshi-hook install # write hooks for each agent
moshi-hook serveGhostty & Git
Terminal GPU nhanh, nhiều tài khoản Git trên một máy, diff dễ review.A fast GPU terminal, several Git accounts on one machine, diffs that are easy to review.
~/.config/ghostty/config
font-family = "JetBrainsMono Nerd Font"
font-size = 14
adjust-cell-height = 10%
theme = "Catppuccin Mocha"
background-opacity = 0.93
background-blur-radius = 25
window-padding-x = 14
window-padding-y = 14
window-padding-balance = true
macos-titlebar-style = transparent
cursor-style = bar
mouse-hide-while-typing = true
copy-on-select = clipboardPhím tắt mặc định: ⌘D chia dọc, ⌘⇧D chia ngang, ⌘[/⌘] đổi pane.Default keys: ⌘D split right, ⌘⇧D split down, ⌘[/⌘] switch panes.
Git globalGlobal Git
git config --global user.name "Your Name"
git config --global init.defaultBranch main
git config --global pull.ff only
git config --global core.excludesfile ~/.gitignore_global
git config --global core.pager delta
git config --global interactive.diffFilter "delta --color-only"
git config --global delta.navigate true
git config --global delta.line-numbers true
git config --global delta.syntax-theme "Catppuccin Mocha"
printf '.DS_Store\n*~\n.env\n.env.local\n' >> ~/.gitignore_globalNhiều tài khoản (cá nhân / công ty)Multiple accounts (personal / work)
Mỗi tài khoản một khoá SSH và một Host alias; email/identity theo thư mục bằng includeIf.One SSH key and Host alias per account; per-folder email/identity via includeIf.
ssh-keygen -t ed25519 -C "you@example.com" -f ~/.ssh/personal-github
ssh-keygen -t ed25519 -C "you@company.com" -f ~/.ssh/work-github
gh ssh-key add ~/.ssh/personal-github.pub# ~/.ssh/config
Host personal-github
HostName github.com
User git
IdentityFile ~/.ssh/personal-github
UseKeychain yes
AddKeysToAgent yes
Host work-github
HostName github.com
User git
IdentityFile ~/.ssh/work-github
UseKeychain yes
AddKeysToAgent yes
# clone: git clone personal-github:owner/repo.git# ~/.gitconfig
[includeIf "gitdir:~/Documents/git/work/"]
path = ~/.config/git/work.gitconfig
# ~/.config/git/work.gitconfig
[user]
email = you@company.comỨng dụngApps
Tất cả có trong Brewfile, trừ Xcode (App Store).All in the Brewfile, except Xcode (App Store).
Raycast
Thay Spotlight, chia cửa sổ, snippet.Spotlight replacement, window layouts, snippets.
CleanShot X
Chụp/quay màn hình, chú thích — gửi ảnh lỗi cho agent.Screenshots/recordings with annotation — feed bug screenshots to agents.
Paste
Lịch sử clipboard: lấy lại lệnh, log, prompt cũ.Clipboard history: recall commands, logs, old prompts.
OpenKey
Gõ tiếng Việt; thêm terminal vào danh sách loại trừ nếu cần.Vietnamese input; exclude terminals if it interferes.
VS Code · WebStorm
Đọc và sửa tay khi cần; review diff lớn.Manual reading/editing; reviewing large diffs.
TablePlus · Postman
Xem database, gọi thử API.Inspect databases, try APIs.
Chrome
Kèm extension Claude in Chrome để agent điều khiển trình duyệt và đọc console.With the Claude in Chrome extension so agents can drive the browser and read the console.
Slack · Discord
Liên lạc team.Team communication.
Kiểm traVerify
Chạy lại bất cứ lúc nào sau khi cài hoặc cập nhật.Run any time after installing or updating.
brew bundle check --file=Brewfile --verbose
bash scripts/verify-setup.sh # add --vi for VietnameseCập nhật định kỳ: brew update && brew upgrade. Claude Code tự cập nhật; các agent khác cập nhật theo Homebrew.Routine updates: brew update && brew upgrade. Claude Code updates itself; other agents update via Homebrew.