0
0
PowershellHow-ToBeginner · 3 min read

How to Install PowerShell: Step-by-Step Guide

To install PowerShell, download the latest installer from the official Microsoft GitHub page for your operating system, then run the installer and follow the prompts. On Windows, you can also install it via winget or chocolatey package managers for easy setup.
📐

Syntax

Installing PowerShell depends on your operating system and method. Here are common commands and steps:

  • Windows: Use winget install --id Microsoft.PowerShell or download the MSI installer.
  • macOS: Use brew install --cask powershell or download the PKG installer.
  • Linux: Use your package manager like apt, yum, or download the tar.gz package.

Each method installs PowerShell and makes it available as pwsh command.

powershell
winget install --id Microsoft.PowerShell
💻

Example

This example shows how to install PowerShell on Windows using winget. It downloads and installs the latest stable version automatically.

powershell
winget install --id Microsoft.PowerShell -e --source winget
Output
Found PowerShell [Microsoft.PowerShell] Installing PowerShell... Successfully installed PowerShell.
⚠️

Common Pitfalls

Common mistakes when installing PowerShell include:

  • Not running the installer or package manager with administrator rights.
  • Using outdated installers from unofficial sources.
  • Confusing Windows PowerShell (built-in) with PowerShell Core (pwsh).
  • Not adding PowerShell to the system PATH, causing pwsh command to fail.

Always use official Microsoft sources and run commands as admin.

powershell
# Wrong: Running winget without admin
winget install --id Microsoft.PowerShell

# Right: Run PowerShell as admin first
Start-Process powershell -Verb runAs
winget install --id Microsoft.PowerShell
📊

Quick Reference

PlatformInstallation MethodCommand or Link
Windowswinget package managerwinget install --id Microsoft.PowerShell
WindowsChocolatey package managerchoco install powershell-core
WindowsMSI Installerhttps://github.com/PowerShell/PowerShell/releases
macOSHomebrewbrew install --cask powershell
macOSPKG Installerhttps://github.com/PowerShell/PowerShell/releases
LinuxAPT (Debian/Ubuntu)sudo apt install -y powershell
LinuxYUM (CentOS/RHEL)sudo yum install -y powershell
LinuxTarballhttps://github.com/PowerShell/PowerShell/releases

Key Takeaways

Use official Microsoft sources or trusted package managers to install PowerShell.
Run installation commands with administrator or root privileges to avoid permission errors.
PowerShell Core is installed as the 'pwsh' command, different from Windows PowerShell.
Check your system PATH if 'pwsh' command is not recognized after installation.
Use platform-specific package managers for the easiest and most reliable installation.