目前主力工作環境是 macOS,用這篇文章記錄一下從無到有設定整個 macOS 的流程。
硬體
- Macbook Pro 2019 16"
- CPU: Intel i9, 2.4 GHz, 8 Core
- RAM: 32GB
- SSD: 512GB
2020 年初為替換 Macbook Pro 2016 15" 而購買的,雖然當時市場上已有即將改為 ARM 架構的風聲傳出,但考量到架構間的轉換及一開始的軟體穩定性,最後仍然選擇頂規的 16" Macbook Pro。
軟體
- Homebrew:不必解釋,必裝的套件管理器
Homebrew
- 開發:
vim
,git
,git-flow-avh
- 網路:
curl
,wget
,httpie
- GNU Tools:
coreutils
,findutils
,gnu-tar
,gnu-sed
,gawk
,gnutls
,gnu-getopt
,grep
- 程式語言:
php
,composer
,nodejs
,go
,rust
,python
- 其它:
zsh
,lsd
,jq
,htop
,fzf
因為用不慣 macOS 自帶的一些指令(可能是因為授權的緣故,macOS 內建的指令版本都舊很多),所以我通常會重新安裝 GNU Tools。
需要注意的是,如果要讓 GNU Tools 的指令取代原本的指令,需要在 .bashrc
或 .zshrc
中加入以下內容
|
|
Homebrew Cask
- squirrel:Rime 輸入法,用於實現嘸蝦米輸入法的引擎
通常會建議不要使用 Homebrew Cask 安裝會自動更新的軟體(如 Visual Studio Code 或 Microsoft Edge 等),這是因為 Homebrew 的 Upgrade 指令可能會與內建的自動更新互相衝突。
Homebrew Fonts
font-source-code-pro
font-jetbrans-mono
font-hack-nerd-font
:用於與lsd
相互搭配font-noto-sans
,font-noto-sans-cjk-tc
,font-noto-serif
,font-noto-serif-cjk-tc
在編輯器內(如 Visual Studio Code 或 Jetbrans IDEs)會習慣使用 Jetbrains Mono;在 Terminal 內則用 Source Code Pro 較多。
Composer
psy/psysh
phpunit/phpunit
friendsofphp/php-cs-fixer
ZSH
其它
開發工具
瀏覽器
社交
其它
設定
SSH
- 建立 SSH Key:
ssh-keygen -t ed25519 -C "mbp2019"
- 加入設定檔
# ~/.ssh/config
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_ed25519
- 加入 Keychain Access:
eval "$(ssh-agent -s)"; ssh-add -K ~/.ssh/id_ed25519
Git
- 加入
.gitignore_global
# ~/.gitignore_global
# Created by https://www.toptal.com/developers/gitignore/api/macos
# Edit at https://www.toptal.com/developers/gitignore?templates=macos
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# End of https://www.toptal.com/developers/gitignore/api/macos
- 設定 git
|
|
附註
在 ChiVincent/macos-setup 中,我整理了一份可以直接複製貼上的指令表。