Macのターミナルなどの設定 覚書(2022年10月30日時点)
MacBook Airを買ったので備忘録。
PCの初期設定と必要なブラウザのインストールが終わったあと、ターミナルをStarshipで見やすくしてNode.jsが使えるところまでの設定の手順を残しておく。
私のPC作業環境については前に書いた記事を参考にしてください。
手順
- 各種インストールの前にXcodeをインストールし、homebrewを使って各種インストール。
- ターミナル用のフォントはnerdfontsから気に入ったフォント、VSCodeにはCicaをインストールする。
- GitとStarship、Voltaなどをhomebrew経由でインストールする。(GitはMac標準のものからパスを通すことで切り替える)
- ターミナルのプロファイルを設定する。デザインは"Homebrew"。
フォントは"Code New Roman Nerd Font"で文字サイズは14を設定。
テキストの"テキストをアンチエイリアス処理"にチェックを入れておく。
大雑把だがターミナルで打つコマンドは下の通り。
// Xcodeのインストール xcode-select --install // Homebrewのインストール /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" // Gitのインストール brew install git // ./zshrcの編集 iでインサートモードで編集してGitのパスを通す。下にある.zshrcの内容を追記 vi ~/.zshrc // シェルの再起動 exec $SHELL -l // Starshipのインストール brew install starship // Starship設定ファイルの作成 mkdir -p ~/.config && touch ~/.config/starship.toml // VS Codeのインストール brew install visual-studio-code --cask
.zshrcに追記する内容
# Gitのパス export PATH=/usr/local/bin/git:$PATH # Starshipのパス eval "$(starship init zsh)"
starship.tomlの内容
[directory] #ディレクトリ表示 truncation_length = 10 truncate_to_repo = false [git_status] conflicted = "💥" ahead = "🏎💨" behind = "😰" diverged = "😵" untracked = "🌚" stashed = "📦" modified = "📝" staged = '🔦' renamed = "🏷" deleted = "🗑" [[battery.display]] #バッテリーを表示するタイミング threshold = 100 style = "bold blue" [battery] full_symbol = "🥳" charging_symbol = "🔌" discharging_symbol = "🫠" [time] disabled = false use_12hr = true