如何在 macOS 安裝 PowerShell ?
PowerShell 也能跑在 macOS
隨著 .NET Core 跨平台後,PowerShell 也開始跨平台,事實上 PowerShell 底層跑的就是 .NET Core,有了 PowerShell 之後,macOS 與 Linux 的自動化又有了新的選擇。
Version
macOS High Sierra 10.13.3
PowerShell 6.0.1
安裝 PowerShell
1 | ~ $ brew update |

- 使用
brew cask install安裝powershell - PowerShell 安裝完成
1 | ~ $ pwsh |
pwsh 為 PowerShell 的執行檔。

- 執行
pwsh啟動 PowerShell - 當出現
PS開頭,表示 PowerShell 安裝成功
移除 PowerShell
1 | ~ $ brew cask uninstall powershell |
使用 brew cask uninstall 移除 powershell。

- 使用
brew cask uninstall移除powershell - PowerShell 移除成功
1 | ~ $ pwsh |

若出現 command not found,表示 PowerShell 已經成功移除。
Conclusion
- 透過 Homebrew,安裝與移除 PowerShell 都很簡單,將來若要更新 PowerShell 版本,只要下
brew cask upgrade powershell即可