PowerShell is a powerful command-line tool that enables system administrators and developers to automate tasks and manage systems more efficiently. While PowerShell is native to Windows, the latest versions are available on all modern operating systems. So no matter if you’re running Windows, macOS or Linux, you can run PowerShell and start using this amazing language! In this article, we’ll show you how to install PowerShell on Windows, macOS, and Linux.
Installing PowerShell on Windows
If you’re running Windows 10, PowerShell is already installed by default. However, if you’re running an earlier version of Windows, or you want to install a newer version of PowerShell, you can do so by downloading it from the official PowerShell website.
And by the way, definitely upgrade to the latest version of PowerShell! Don’t stick with the version of Windows PowerShell that came with your Operating System. You want to take advantage of all of the features in the latest versions. So you need to get PowerShell 7 and here’s how to do it!
Here’s how to install PowerShell 7 on Windows:
- Go to the official PowerShell website at https://github.com/PowerShell/PowerShell/releases.
- Click on the “Assets” drop-down menu.
- Select the version of PowerShell that matches your operating system.
- Download the file and run the installation wizard.
- Once installed, you can open PowerShell by typing “powershell” in the search bar or the Run dialog.
Installing PowerShell on macOS:
If you’re running macOS, you can install PowerShell using Homebrew, a package manager for macOS.
Here’s how to get PowerShell 7 on your Mac:
- Open Terminal on your Mac.
- Run the command “brew install –cask powershell”.
- Wait for the installation to complete.
- Once installed, you can open PowerShell by typing “pwsh” in the Terminal.
Installing PowerShell on Linux
PowerShell is available on many Linux distributions, including Ubuntu, Debian, and CentOS. Here’s how to install PowerShell on each of these distributions:
How to install PowerShell 7 on all these awesome Linux Distros:
- Ubuntu: Update the packages available in the apt-get package repos, then you can install by running the command “sudo apt-get install -y powershell”.
Here’s all of it put together (this works on all Long Support Builds (18.04, 20.04, 22.04)
# Update the list of packages sudo apt-get update # Install pre-requisite packages. sudo apt-get install -y wget apt-transport-https software-properties-common # Download the Microsoft repository GPG keys wget -q "https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb" # Register the Microsoft repository GPG keys sudo dpkg -i packages-microsoft-prod.deb # Update the list of packages after we added packages.microsoft.com sudo apt-get update # Install PowerShell sudo apt-get install -y powershell # Start PowerShell pwsh
- Debian: Run the command “wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && sudo dpkg -i packages-microsoft-prod.deb && sudo apt-get update && sudo apt-get install -y powershell”.
- CentOS: Run the command “curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo && sudo yum install -y powershell”.
Once installed, you can open PowerShell by typing “pwsh” in the Terminal.
Conclusion
Installing PowerShell on Windows, macOS, and Linux is straightforward and easy. With PowerShell 7, you can manage your systems and automate your tasks more efficiently, no matter which operating system you prefer. And if you’ve taken this advice and updated your Windows OS to the latest version of PowerShell, you’re going to have a very smooth transition between your different workstations and laptops where it’s installed.
Give it a try and see how it can improve your workflow!