๐Ÿ‡ฏ๐Ÿ‡ต ๆ—ฅๆœฌ่ชž | ๐Ÿ‡บ๐Ÿ‡ธ English | ๐Ÿ‡ช๐Ÿ‡ธ Espaรฑol | ๐Ÿ‡ต๐Ÿ‡น Portuguรชs | ๐Ÿ‡น๐Ÿ‡ญ เน„เธ—เธข | ๐Ÿ‡จ๐Ÿ‡ณ ไธญๆ–‡

[For Beginners] How to Install and Launch PowerShell (Windows / Mac / Linux)

In the last article, "What is PowerShell? A Deep Dive into the Ultimate Shell Every Windows User Should Know," we learned that PowerShell is not just a command prompt but a super-powerful shell that manipulates objects. After getting a glimpse of its charm and power, you're probably thinking, "I definitely want to try this!"

However, the "Windows PowerShell" that comes pre-installed on your Windows is a slightly older version (5.1), and it's no longer receiving new features. The version that truly shines in modern web development is the new, open-source "PowerShell (version 7 and later)." This has evolved into a cross-platform tool that works exactly the same not only on Windows but also on macOS and Linux.

In this article, we'll carefully explain the procedure for installing and launching the latest version of PowerShell on each OS, in a way that even beginners won't get lost. Let's install this modern shell on your favorite machine and boost your web development efficiency!


Why a New PowerShell? The Difference from Windows PowerShell

First, let's answer the question, "If it's already on Windows, why do I need to install a new one?" There's a clear difference between the two.

To put it another way, Windows PowerShell is like a "landline phone that came with the house," while the new PowerShell is like the "latest smartphone." Both can make calls, but the range of things they can do and their future potential are completely different. This article will explain how to get the "latest smartphone."


1. How to Install PowerShell on Windows

The easiest and smartest way to install it on Windows is by using winget, the standard Windows package manager.

Step 1: Search for PowerShell with winget

First, open PowerShell or Terminal (administrator rights are not required), and let's search for available PowerShell packages with the following command.

winget search Microsoft.PowerShell

If "Microsoft.PowerShell" appears in the list, then winget is ready to use.


Step 2: Install PowerShell with winget

Now, let's run the following command to install the latest stable version of PowerShell.

winget install --id Microsoft.PowerShell --source winget

The installer will be downloaded automatically, and the setup will be completed.


Step 3: Launch and Verify the New PowerShell

After installation, when you open the Start Menu, you will find a new "PowerShell" with a black icon, separate from the traditional blue "Windows PowerShell." Click on it to launch.

Once it's launched, let's check the version. Run the following command.

$PSVersionTable

If the PSVersion in the displayed results looks like "7.x.x", then the installation of the latest version was a success!


2. How to Install PowerShell on macOS

On macOS, the easiest way is to use the package manager Homebrew.

Step 1: Install PowerShell with Homebrew

Open the Terminal, and you can install it with a single command.

brew install --cask powershell

Step 2: Launch and Verify PowerShell

Once the installation is complete, you can launch PowerShell just by typing the following command in the terminal.

pwsh

If the prompt changes to something like PS /Users/yourname>, PowerShell is running. You can confirm that it's version 7 or later with $PSVersionTable.


3. How to Install PowerShell on Linux (Ubuntu/Debian)

On Linux, the common practice is to register Microsoft's official package repository and then install from there. Here are the steps for Ubuntu/Debian-based systems.

Step 1: Preparation

First, update the package list and install the necessary tools.

sudo apt-get update
sudo apt-get install -y wget apt-transport-https software-properties-common

Step 2: Get the Microsoft Repository GPG Key

Download the key to verify the authenticity of the packages.

wget -q "https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb"
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb

Step 3: Install PowerShell

Update the repository information, and now you're ready to install PowerShell.

sudo apt-get update
sudo apt-get install -y powershell

Step 4: Launch and Verify

After installation, you can launch it with the pwsh command. Just like on macOS, let's check the version.

pwsh

Conclusion

Great work! With this, you now have a modern, cross-platform PowerShell environment on your Windows, macOS, or Linux machine. The ability to run the same commands and the same scripts across OS boundaries is a huge advantage in web development.

For Windows users in particular, we hope you've been excited by the possibilities of automation, getting a taste of the "object" and "pipeline" philosophy that overturns the conventional wisdom of the old Command Prompt.

Now that your environment is set up, you are already on the path to becoming a master of the ultimate shell. In the next article, we'll introduce a curated list of the 10 most useful basic cmdlets to learn first with this new PowerShell. Stay tuned!

Top 10 PowerShell Commands for Beginners to Learn First (Get-Process, Set-Location, etc.)