蘋果環境

iTerm2

終端機與開發環境

開發者必備終端機。

安裝步驟

安裝 command line

  • 更新 Xcode command line:xcode-select --install

安裝 Homebrew 與 ZSH

  • 安裝
    • 快速(一行):/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" && eval "$(/opt/homebrew/bin/brew shellenv)" && brew --version && brew doctor && brew update && brew install zsh && sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
    • 分步:
      1. /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
      2. 載入指令:eval "$(/opt/homebrew/bin/brew shellenv)"
      3. 顯示版本:brew --version
      4. 檢查:brew doctor
      5. 更新:brew update
      6. 安裝 ZSH:brew install zsh
      7. 安裝 oh-my-zsh:sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
  • 設定
    • 設置 Homebrew bin 位置:echo "\n# Brew\nexport PATH=\"\$PATH:/opt/homebrew/bin\"" >> ~/.zshrc
    • 更新設定檔:source ~/.zshrc
    • 重開 iTerm

建立 SSH

  • 產生金鑰:ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519
  • 複製公鑰
    • pbcopy < ~/.ssh/id_ed25519.pub
    • 貼到 GitHub:右上頭像 ❯ Settings ❯ SSH and GPG keys ❯ New SSH Key - 貼上公鑰
    • 貼到 BitBucket:右上齒輪 ❯ Personal BitBucket settings ❯ SSH keys ❯ Add Key - 貼上公鑰
    • 要自動登入 Server,貼到 Server 的 ~/.ssh/authorized_keys

常用設定

  • 快捷鍵 command + , 開啟設定
  • General ❯ Selection ❯ Clicking on a command selects it to restrict Find and Filter - 取消
  • Profiles - 先選左邊的 Default 再進行以下設定
    • General ❯ Working Directory ❯ Directory - 輸入開啟時的位置 ~/Workspace
    • Color
      • 取消勾選 User separatete colors for light and dark mode
      • Color Preset 選擇 Dark Background
    • Text
      • Font ❯ Hack ❯ 標準體(Regular) ❯ 18
      • Use a different font for non-ASCII text - 勾選
      • Non-ASCII Font ❯ Hack ❯ 標準體(Regular) ❯ 18
    • Window ❯ Settings for New Windows - Columns 調整為 120、Rows 調整為 38
    • Terminal ❯ Scrollback lines 調整為 3,000(可依需求調整;想無限保留則勾選 Unlimited scrollback
  • Keys
    • 游標移至最前 - 按 +Click to Set,按下 command + ←,Action 選 Send Hex Code,輸入 0x01
    • 游標移至最後 - 按 +Click to Set,按下 command + →,Action 選 Send Hex Code,輸入 0x05
    • 切換左邊頁籤 - 按 +Click to Set,按下 command + option + ←,Action 選 Previous Tab
    • 切換右邊頁籤 - 按 +Click to Set,按下 command + option + →,Action 選 Next Tab
    • 切換左方分頁 - 按 +Click to Set,按下 command + control + ←,Action 選 Select Split Pane on Left
    • 切換右方分頁 - 按 +Click to Set,按下 command + control + →,Action 選 Select Split Pane on Right
    • 切換上方分頁 - 按 +Click to Set,按下 command + control + ↑,Action 選 Select Split Pane Above
    • 切換下方分頁 - 按 +Click to Set,按下 command + control + ↓,Action 選 Select Split Pane Below

相關參考