Installing PowerCLI on MacOS Mojave

After just getting started with PowerCLI on my company Windows 10 notebook I read that you could also run it on Linux and MacOS systems since last year. As I just started to like the functionality (took some time when you are only accustomed to Bash and Python) I wanted to give that a try on my private Macbook Pro, so here are the steps I took:

PowerShell stable release download page on Github

First download the latest stable release for MacOS (shown above), currently “powershell-6.1.2-osx-x64.pkg“, and install it.
Then open a shell, either by clicking on “PowerShell” in the Launchpad or open a Terminal window and enter “pwsh”.

PowerCLI installation in PowerShell on MacOS

Then simply enter the following:

Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
Install-Module -Name VMware.PowerCLI -Scope CurrentUser

If you skip the first line the PSGallery repository, which hosts the PowerCLI packages, is not trusted, resulting in the following warning:

Untrusted repository
 You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you
  sure you want to install the modules from 'PSGallery'?
 [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"):

Updating to a new version works as follows:

Update-Module -Name VMware.PowerCLI

One thought on “Installing PowerCLI on MacOS Mojave”

  1. Once you are in pwsh, for me I had to run the following to be able to connect to viserver:
    Set-PowerCLIConfiguration -InvalidCertificateAction:Ignore

Comments are closed.