設定MacOS 終端機環境 (Homebrew/zsh/oh-my-zsh/iTerm2)

时间:2023-03-08 17:41:44

安裝Homebrew

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

更新Homebrew

1
brew update

安裝wget

1
brew install wget

安裝zsh

1
brew install zsh

更新zsh

1
brew upgrade zsh

修改預設shell為zsh

1
$ chsh -s /usr/local/bin/zsh

安裝oh-my-zsh

1
$ git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh

安裝zsh-completions

1
brew install zsh-completions

新增設定 (我習慣用nano開…很多範例都用vim 也是可以XD)

nano .zshrc
1
2
# zsh-completions
fpath=(/usr/local/share/zsh-completions $fpath)

rebuild zsh 的 .zcompdump

1
$ rm -f ~/.zcompdump; compinit

切換zsh theme

1
ZSH_THEME="THEME NAME"

安裝zsh-syntax-highlighting程式碼高亮

1
brew install zsh-syntax-highlighting

安裝iTerm2

1
brew cask install iterm2

大专栏  設定MacOS 終端機環境 (Homebrew/zsh/oh-my-zsh/iTerm2)href="#修改iTerm2" class="headerlink" title="修改iTerm2">修改iTerm2

安裝iTerm2配色包

1
git clone https://github.com/mbadolato/iTerm2-Color-Schemes.git ~/iTermTheme

https://medium.com/statementdog-engineering/prettify-your-zsh-command-line-prompt-3ca2acc967f

更新Node.js

看版本

1
2
node -v
npm -v

清除cache

1
sudo npm cache clean -f

安裝工具

1
sudo npm install -g n

選擇版本安裝

1
sudo n latest
1
sudo n stable
1
sudo n 8.9.0

刪除某一版的nodejs

1
sudo n rm 9.0.0

更新npm

1
sudo npm install npm@latest -g

Reference

Homebrew

https://brew.sh/index_zh-tw.html

Zsh

https://github.com/unixorn/awesome-zsh-plugins

http://icarus4.logdown.com/posts/177661-from-bash-to-zsh-setup-tips

https://pjchender.blogspot.tw/2017/02/mac-terminal-iterm-2-oh-my-zsh.html

http://xanxusvervr.blogspot.tw/2017/06/mac.html

Zsh Theme

https://github.com/marszall87/nodeys-zsh-theme