Mac PowerShell Core: After upgrading you receive the message powershell: command not found

After installing (via https://github.com/PowerShell/PowerShell) PowerShell Alpha 9 to the latest version RC you receive the message powershell: command not found.

The first thing I did to troubleshoot this issue was remove all of the PowerShell versions as I saw two installations in the /usr/local/microsoft/powershell folder. I chose to run this command:

sudo rm -rf /usr/local/bin/pwsh /usr/local/microsoft/powershell

Then I installed PowerShell via brew by running the following command: brew cask install powershell

Again I got the message powershell: command not found.

So I cd’ed into the folder /usr/local/Microsoft/powershell/6.0.0-rc/ and ran the pwsh command. PowerShell started successfully!

Ok, so the problem is probably in the symbolic link, cd to the folder /usr/local/bin and execute

ls -la power*

lrwxr-xr-x    1 username  wheel      56 25 aug  2016 powershell /usr/local/microsoft/powershell/6.0.0-alpha.9/powershell

aha that’s the issue.

First run unlink powershell and check with ls -la power* if it successfully removed the symbolic link. If it’s removed then run the following command:

sudo ln -s /usr/local/microsoft/powershell/6.0.0-rc/pwsh /usr/local/bin/powershell

Greetings,

Daniel Nikolic

Is interested in everything connected to technology. Has a passion for cloud, virtualization and software development. Always finds appropriate IT solutions for customers that match their needs strategically, technically and financially.


Core qualities

Quick thinker, result driven, ambitious, customer-friendly, enthusiastic

Hobbies
Running, listening to music, good food and doing fun things with family

Job description
CTO PepperByte, LoadGen, and BlueParq

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *