LoginSignup
12
20

More than 5 years have passed since last update.

macのterminal設定 (iterm2 & zsh、テーマはIceberg)

Posted at

新しいmacを買ってterminalの設定(iterm & zsh、テーマはIceberg) をし直したのでメモ

iterm2のインストール&設定

インストール

https://www.iterm2.com/
ダウンロードしてアプリケーションフォルダに突っ込む。以上。

iterm2のテーマ変更

Iceberg
GitHubのReadmeにしたがってインストール

ついでに、Iceberg作成者作成のterminalへの適用手順を参照してターミナルのテーマも変更しておいた。

Homebrewのインストール

Homebrewをインストール

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

zsh&zplugをインストール

zshインストール

参考記事

brew install zsh zsh-autosuggestions zsh-completions zsh-syntax-highlighting colordiff reattach-to-user-namespace tmux

zplugインストール

zshのプラグイン管理ツールのzplugをインストール

brew install zplug

zshrcに以下追加(brew install時にメッセージで教えてくれた)

.zshrc
export ZPLUG_HOME=/usr/local/opt/zplug
source $ZPLUG_HOME/init.zsh

.zprofile .zshrcの設定

.zshの設定ファイルの種類と詳細はこちら参照

今回は以下を設定

.zprofile
# 補完機能
autoload -U compinit
compinit

# コマンド履歴
HISTFILE=~/.zsh_history
HISTSIZE=6000000
SAVEHIST=6000000
setopt hist_ignore_dups     # ignore duplication command history list
setopt share_history        # share command history data

# コマンド履歴検索
autoload history-search-end
zle -N history-beginning-search-backward-end history-search-end
zle -N history-beginning-search-forward-end history-search-end
bindkey "^P" history-beginning-search-backward-end
bindkey "^N" history-beginning-search-forward-end

# alias
alias diff="coloddiff"
.zshrc
# zplugの設定
export ZPLUG_HOME=/usr/local/opt/zplug
source $ZPLUG_HOME/init.zsh

# syntax
zplug "chrissicool/zsh-256color"
zplug "Tarrasch/zsh-colors"
zplug "zsh-users/zsh-syntax-highlighting"
zplug "ascii-soup/zsh-url-highlighter"

# 未インストール項目をインストールする
if ! zplug check --verbose; then
    printf "Install? [y/N]: "
    if read -q; then
        echo; zplug install
    fi
fi

# コマンドをリンクして、PATH に追加し、プラグインは読み込む
zplug load --verbose

# zplugの設定ここまで
source ~/.zprofile
source ~/.zshrc

ログインシェルをbashからzshにshell変更

システム環境設定からユーザとグループを選択し、鍵のチェックを外す。
該当ユーザに対し、副クリック(Control+クリック)で、詳細オプションを表示し、
ログインシェルを/bin/bashから/usr/local/bin/zshに切り替える。

プロンプトをpureに変更

pureって?

pure
「きれい」「最小限」「早い」が売りのzsh向けプロンプトテーマ

node.jsのインストール

pureのインストールの為、node.jsをインストール

nodebrewのインストール

nodebrew

homebrewを使ってインストール

 brew install nodebrew

パスを通す zshrcに以下追加

.zshrc
export PATH=$HOME/.nodebrew/current/bin:$PATH

nodebrewのセットアップ

source .zshrc
nodebrew setup

Node.jsインストール

nodebrew install-binary stable
nodebrew use stable

インストールできた事を確認

node -v #v10.15.0
npm -v #6.4.1

pureのインストール

pure

npm install --global pure-prompt

.zshrcに以下追加

.zshrc
autoload -U promptinit; promptinit
prompt pure
source ~/.zshrc
12
20
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
20