Installing PowerShell, PowerCLI and Visual Studio Code (VS Code) on Mac

If you don't know, I happen to be an Apple ecosystem user, iPhone, Mac, Ipad, AppleTV, Homepod I have them all, but I use Powershell, PowerCLI and Visual Studio code a lot in my day job.  Thankfully now its easy just to install them on my Mac, no Windows required.

Installing Powershell.

This is pretty easy to do using brew right in Terminal, I found the MS Guide for this skipped a step, but included the link here so you check the official page and  can tell I'm not trying to install some nefarious code.

Open Terminal and run the following to install Brew.  FYI you will probably need to enter your password a couple of times through this whole process.

 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 
 
Install Brew
export PATH=/opt/homebrew/bin:$PATH
Add Brew to Path
brew install --cask powershell
Install Powershell

Installing PowerCLI

Now powershell is installed everything gets easier at the same terminal prompt.

#switch to powershell
pwsh
#trust PSGallery Repos
Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted 
#Install PowerCLI
Install-Module -Name VMware.PowerCLI -Scope CurrentUser
#set the CEIP so you don't get annoying messages, use $true or $false
Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $true

Installing Visual Studio Code

You can do this by downloading from the web here or by using brew again.

brew install --cask visual-studio-code
Using Brew to install visual studio code

To update these when new version of brew and powershell are released, you can do the following from PowerShell :

# update brew, do this always before updating anything else.
brew update
#update powershell
brew upgrade powershell --cask
# update PowerCLI (must be in powershell to do this)
Update-Module -Name VMware.PowerCLI
#upgrade vs code
brew upgrade visual-studio-code --cask
Update everything

Setup Visual Studio Code

Usually I select the sync setting option, log in with my github account and it installs all my extensions for me.

  • Winter is Coming Color Theme (Dark Blue) - John Papa
  • Jupyter (Intellsense for VS Code) - Microsoft
  • Powershell - Microsoft
  • Pylance (Python for VS Code) - Microsoft
  • Python (IntelliSense for Python) -Microsoft
  • HTML CSS Support - Ecmel
  • Color Highlight (Highlights web colors in code) -Sergii N