我的 MacBook Pro (Apple Silicon) 設定

現在開始因為 ChatGPT 的出現,各種 AI 助手的功能都跑出來了。想想自己用了許久的環境設定也應該要來重新審視和建立新的開發環境了,僅此紀錄我個人的環境配置步驟和設定。

環境前置步驟

  1. 還原 MacBook Pro 至全新環境 macOS(全部資料刪除)

  2. 設定好初始設定後,登入 Apple ID 進入 App Store 確定 macOS 版本和預設 APP 都更新到最新 macOS 版本

  3. 到系統設定調整所有設定至個人習慣的設定

    • 三指拖移

    • 觸控板手勢開啟

    • 防火牆開啟

    • 輸入法設定

  4. 安裝 Safari Extension 和設定開啟開發者清單

  5. 到 App Store 安裝 XCode,安裝完後開啟 XCode 安裝 Command Line Tool

軟體安裝

分不同的類別,順序不影響

字體 Font

一般用途

  • App Store:Magnet - 視窗管理

  • App Store:The Unarchiver - 解壓縮工具

  • 1Password - 密碼管理工具

  • Bitdefender - 防毒軟體

  • CleanMyMacX - 空間清理

  • Bartender - Menu bar 管理工具

  • CheatSheet - 快捷鍵查詢

  • Raycast - 免費的 Spotlight 加強版

  • MacGPT - 串接 ChatGPT

  • Rewind - 個人操作記錄

  • Chrome

  • Edge

  • TradingView

  • ClickUp

  • Rize - 個人時間追蹤軟體

文書

  • Notion

  • Miro

  • Grammarly

  • Dash

  • Anki

  • Airtable

  • App Store:Day One

  • App Store:Feedly

  • App Store:OneNote

  • App Store:Habitify

  • App Store:GoodNotes

通訊

  • App Store:Line

  • App Store:Slack

  • App Store:Twitter

  • Discord

  • Zoom

影音

  • App Store:Shazam

  • App Store:Noizio - 白噪音

  • App Store:Motion

  • App Store:Final Cut Pro

  • App Store:Logic Pro

  • App Store:MainStage

  • App Store:Compressor

  • Steam

  • OBS

  • Spotify

  • VLC

開發工具

  • iTerm2

  • Wrap

  • Termius

  • Docker

  • GPG Keychain

  • Fig

  • Visual Studio Code

  • Cursor

  • Lens

  • Android Studio

  • RapidAPI / Postman

  • GitKraken

  • Responsively

  • Wireshark

  • Figma

  • TablePlus

  • pgAdmin

  • Querious

  • RedisInsight

環境設定

iTerm2 設定

  1. 到 iterm2 color theme 設定:Tomorrow Night Eighties

  2. 匯入 Profile 設定檔

Zsh Shell 設定

  1. 安裝 Homebrew

  2. 安裝 rvm 並更新 ruby 到最新版本

  3. 開啟 Fig,登入帳號後同步環境設定和 Plugins

    1. oh-my-zsh

    2. zsh-syntax-highlight

    3. zsh-autosuggestions

    4. Powerlevel10k

    5. Git Flow Completion

    6. Kube Color

    7. Zsh Completions

    8. Git Flow

  4. 設定 Fig Aliases systemupdate = sudo gem update --system && sudo gem update && brew update && brew upgrade && omz update && rustup update && kubectl krew update && kubectl krew upgrade && gcloud components update && brew doctor

  5. 開啟 iTerm2 執行 p10k configure 設定或是設定檔放置 ~/.p10k.zsh

  6. 設定 gpg 和 git 全域設定

     gpg --full-generate-key
     gpg --list-secret-keys --keyid-format LONG
     gpg --armor --export <ID>
     git config --global user.name <Name>
     git config --global user.email <Email>
     git config --global commit.gpgsign true
     git config --global gpg.program /usr/local/bin/gpg
     git config --global user.signingkey <ID>
    

安裝 Command Line

General

# General
fig install --dotfiles
brew install --cask 1password/tap/1password-cli
brew install mycli pgcli jq yq tmux tldr shellcheck glances sonarqube hadolint \
  k6 slack-cli streamlink tree ffmpeg postgresql

# GitHub
brew install gh
gh auth login

# GitLab
brew install glab
glab auth login

# CloudFlare
brew install cloudflared

# Ngrok
brew install ngrok
ngrok config add-authtoken <Token>

# Shopify
brew tap shopify/shopify
brew install 
shopify login

# Ytarhcive
brew install danirukun/ytarchive/ytarchive
ytarchive --write-thumbnail -t --merge --add-metadata <URL> best

brew install go
brew install terraform terragrunt terraform-docs
brew install swift-format

Cloud Service

# gcloud
curl https://sdk.cloud.google.com | zsh
gcloud init

# firebase
curl -sL https://firebase.tools | upgrade=true zsh
firebase login:ci

# awscli
brew install awscli session-manager-plugin cdk8s cdktf
brew tap weaveworks/tap
brew install weaveworks/tap/eksctl
brew install aws/tap/copilot-cli
aws configure
aws configure set region ap-northeast-1
npm install -g aws-cdk

# azure cli
brew install azure-cli
az login

Kubernetes

# 快速切換 K8S Cluster 和 Namespace 的工具
brew install kubectx kustomize k9s skaffold helm helmfile 

# Kubernetes Operations
brew install kops
# SDK for building Kubernetes applications
brew install operator-sdk
# A tool for exploring each layer in a docker image
brew install dive
# The lazier way to manage everything docker
brew install lazydocker
# Container Image Linter for Security
brew install goodwithtech/r/dockle

brew tap kubeshark/kubeshark
brew install kubeshark

# Helm plugin
helm plugin install https://github.com/jkroepke/helm-secrets
helm plugin install https://github.com/databus23/helm-diff
krew
  1. Install Krew

  2. 在 Fig 設定 PATH 中加上 ${KREW_ROOT:-$HOME/.krew}/bin

# Show an RBAC access matrix for server resources
kubectl krew install access-matrix

# Manage cert-manager resources inside your cluster
kubectl krew install cert-manager

# Provides an overview of resource requests, limits, and utilization
kubectl krew install resource-capacity

# Kubernetes static code analysis
kubectl krew install score

# Show a tree of object hierarchies through ownerReferences
kubectl krew install tree

# Trace Kubernetes pods and nodes with system tools
kubectl krew install trace

Python

brew install python@3.11
ln -s -f /usr/local/bin/python3 /usr/local/bin/python
brew install pipenv poetry

Node.js

  1. 安裝 nvm
nvm install-latest-npm

# General Tool
brew install watchman
npm i -g @vue/cli @angular/cli npm-check-updates vercel

# GitHub copilot
npm install -g @githubnext/github-copilot-cli
github-copilot-cli auth
# 在 Fig scripts 加上 eval "$(github-copilot-cli alias -- "$0")"

Rust

# rustup, rust version manager
brew install rustup
# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# source $HOME/.cargo/env
# WASM
cargo install wasm-pack

Java

brew install openjdk
sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk

Fig PATH 加上 /opt/homebrew/opt/openjdk/bin


嘗試和改進

幾個嘗試改變的調整

  1. 導入 1Password 來做 SSH agent 的管理

    • 缺陷:目前遇到開啟 VSCode 有些套件要存取 KeyChain 或是 SSH 都需要做授權的問題
  2. 使用 Fig 來做環境設定和同步

    • 缺陷:沒有辦法很好的管理已經現有的環境,然後一些安裝的 Script 會直接幫忙寫入 ENV 或 Script 到 .zshrc 中,但現在變成都還要自己手動加入到 Fig 中
  3. 使用 Raycast 來加強和自動化個人的工作流程

    • 改進:功能很強大,但還在熟悉中
  4. 嘗試使用 Cursor 來做開發工具

    • 基底看起來是包了 VSCode,但是 Extension 不多。看起來不會掃描既有專案的 Code Base,要使用在現有專案有點難。
  5. 嘗試 Wrap & Termius & GitHub Copilot CLI

    • Wrap 提供的 Wrap AI 滿不錯的搭配 GitHub Copilot CLI 相當好用

    • Termius 可以用於平板做 AWS SSH 的登入操作也相當不錯用,對於突然要進機器處理問題,但又沒有帶筆電時相當好用的工具

  6. 使用 Rewind & ClickUp & Rize & MacGPT

    • Rewind 可以搜尋和記錄自己過去筆電的所有操作,還能對於關鍵字做搜尋相當不錯,但是小心自己看什麼色色的東西也被記錄喔。

    • ClickUp 使用這個平台做自己的個人進度追蹤軟體,算是免費版裡面覺得功能最多,且跨平台。Jira 速度太慢了,受不了所以找了這個。

    • Rize 可以做個人的時間追蹤,想使用這個軟體來分析自己的生產力。缺點是目前只支援 Mac,還沒辦法跨平台到 iPad 或 iPhone。

    • MacGPT 直接在 Mac 上不用開網頁就能跟 ChatGPT 做對話的工具

Did you find this article valuable?

Support 攻城獅 by becoming a sponsor. Any amount is appreciated!