契機就是看到 MacOS 系統都有美美的 treminal,但是 Windows 能夠適用的稍微少了些,所以就繼續一下改裝自己 Bash Terminal 的過程。
前言
先把字型裝起來。
我本身不管是 Windows or MacOS 都是使用 Bash,因此下方步驟則會以此為主。
MacOS
非 M1M2
- 使用指令安裝 OhMyPosh
1
| brew tap jandedobbeleer/oh-my-posh && brew install oh-my-posh
|
- 下載自己喜歡的 Theme 存在自己知道的地方,像我就是存在 finder/Documents
- 原本 MacOS 預設都是 ZSH,不過我有改成 Bash 因此指令就是
1
| eval "$(oh-my-posh --init --shell bash --config <Your json config path>)"
|
M1M2
M1M2 操作上有點特別,如果事前沒有處理過,直接進行安裝可以參考以下步驟:
- 依據安裝 rosetta 的 M1M2 步驟
1 2 3
| /usr/sbin/softwareupdate --install-rosetta --agree-to-license
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
|
- 使用
arch -x86_64 安裝 oh-my-posh
1 2 3 4 5
| arch -x86_64 brew install oh-my-posh
echo eval "$(oh-my-posh --init --shell bash --config <Your json config path>)"
source ~/.bash_profile
|
參考資料:Error: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)
Windows
- 使用 Winget 來進行安裝,開啟 Git Bash 時記得使用「系統管理員」開啟
1
| winget install JanDeDobbeleer.OhMyPosh
|
- 途中會詢問一些內容,type
Y 
- 因為我使用的是 Git Bash 因此指令就是
1
| eval "$(oh-my-posh --init --shell bash --config <Your json config path>)"
|
參考資料:Oh My Posh、Oh My Posh:全平台终端提示符个性化工具
、我選用的主題