Macの環境構築をしたのでメモ。
環境
- MacBook Pro M2(2023)
- MacOS Sequoia 15.1
Homebrewインストール
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Alacrittyインストール
brew install --cask alacritty
~/.config/alacritty/alacritty.toml
ファイルを作成
~/.config/alacritty/alacritty.toml
live_config_reload = true
[window]
dimensions = { columns = 200, lines = 60 }
padding = { x = 8, y = 4 }
opacity = 0.85
[cursor]
style = "Beam"
[scrolling]
history = 100000
multiplier = 3
[font]
normal = { family = "Hack Nerd Font", style = "Regular" }
bold = { family = "Hack Nerd Font", style = "Bold" }
italic = { family = "Hack Nerd Font", style = "Italic" }
bold_italic = { family = "Hack Nerd Font", style = "Bold Italic" }
size = 14.0
offset = { x = 0, y = 2 }
Zinitインストール
bash -c "$(curl --fail --show-error --silent --location https://raw.githubusercontent.com/zdharma-continuum/zinit/HEAD/scripts/install.sh)"
zinit self-update
~/.zshrc
を編集
~/.zshrc
# ----------------------------
# basic
# ----------------------------
# コマンド履歴の管理
HISTFILE=~/.zsh_history
export HISTSIZE=1000
export SAVEHIST=10000
# ----------------------------
# Added by Zinit's installer
# ----------------------------
if [[ ! -f $HOME/.local/share/zinit/zinit.git/zinit.zsh ]]; then
print -P "%F{33} %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f"
command mkdir -p "$HOME/.local/share/zinit" && command chmod g-rwX "$HOME/.local/share/zinit"
command git clone https://github.com/zdharma-continuum/zinit "$HOME/.local/share/zinit/zinit.git" && \
print -P "%F{33} %F{34}Installation successful.%f%b" || \
print -P "%F{160} The clone has failed.%f%b"
fi
source "$HOME/.local/share/zinit/zinit.git/zinit.zsh"
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
# ----------------------------
# Zinit plugins
# ----------------------------
# Load the pure theme, with zsh-async library that's bundled with it.
zinit ice pick"async.zsh" src"pure.zsh"
zinit light sindresorhus/pure
# シンタックスハイライト
zinit light zsh-users/zsh-syntax-highlighting
# 入力補完
zinit light zsh-users/zsh-autosuggestions
zinit light zsh-users/zsh-completions
# コマンド履歴を検索
zinit light zdharma/history-search-multi-word
# ----------------------------
# alias
# ----------------------------
alias g="git"
alias gb="git branch"
alias gs="git switch"
alias gco="git checkout"
alias gcmsg="git commit -m"
alias gl="git pull"
alias gp="git push"
フォントインストール
starshipで必要なフォントをインストールする
brew install --cask font-hack-nerd-font
Starshipインストール
curl -sS https://starship.rs/install.sh | sh
~/.zshrc
の最後に以下を追記する
# ----------------------------
# Starship
# ----------------------------
eval "$(starship init zsh)"
プリセットを使って見た目を変更する
Pastel Powerlineを使いたい場合は以下のコマンドを実行
starship preset pastel-powerline -o ~/.config/starship.toml
VSCodeのフォント設定
VSCodeのターミナルでアイコンが表示されるように設定する。
VSCodeでsettings.json
を開いて以下を設定する。
settings.json
"terminal.integrated.fontFamily": "Hack Nerd Font"
参考