PowerShell Installation
Since version 6.0, PowerShell has achieved full open-source and cross-platform support (PowerShell Core / PowerShell 7+), and can run on Windows, Linux, and macOS.
1. Installing PowerShell 7+ on Windows
Method 1: Using MSI Installer (Recommended)
- Open the official PowerShell GitHub Releases page:
👉 https://github.com/PowerShell/PowerShell/releases - Find the latest version and download the one for Windows
.msiinstaller package - Double-click to install; just use the default path.
- After installation is complete, search for"PowerShell 7"and open it (it will not overwrite Windows PowerShell).
Method 2: Using Command Line (Winget)
Applicable to Windows 10/11 with Windows Package Manager installed:
winget install --id Microsoft.Powershell --source winget
Optional parameters:--silentindicates silent installation,--version 7.4.1can specify a version.
2. Installing PowerShell on Linux
Ubuntu / Debian
# 安装依赖 sudo apt update sudo apt install -y wget apt-transport-https software-properties-common # 导入微软 GPG 密钥 wget -q https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb sudo dpkg -i packages-microsoft-prod.deb # 安装 PowerShell sudo apt update sudo apt install -y powershell
Start PowerShell:
pwsh
CentOS / RHEL / Fedora
# 添加 Microsoft YUM 源 sudo dnf install -y https://packages.microsoft.com/config/rhel/8/packages-microsoft-prod.rpm # 安装 PowerShell sudo dnf install -y powershell
or for CentOS 7, useyum:
sudo yum install -y powershell
Arch Linux / Manjaro
sudo pacman -S powershell
If you cannot find it, you can use the AUR package manager (such as
yay)
3. Installing PowerShell on macOS
Method 1: Using Homebrew (Recommended)
brew install --cask powershell
Start PowerShell:
pwsh
Method 2: Manually Downloading PKG Installer
- Go to the GitHub Releases page
👉 https://github.com/PowerShell/PowerShell/releases - Download
.pkgthe installer file (such aspowershell-7.4.1-osx-x64.pkg) - Double-click to install and follow the prompts to complete.
4. Installation Verification and Uninstallation
Verify whether the installation was successful
pwsh --version
Uninstall PowerShell
| Platform | Uninstallation method |
|---|---|
| Windows | Control Panel → Programs and Features → Uninstall PowerShell 7 |
| Ubuntu | sudo apt remove powershell |
| CentOS | sudo yum remove powershell |
| macOS(brew) | brew uninstall powershell |
Startup Commands on Different Platforms
| Platform | Command |
|---|---|
| Windows | pwsh.exeor search for "PowerShell 7" in the Start menu |
| Linux | pwsh |
| macOS | pwsh |