Skip to content

Instantly share code, notes, and snippets.

@anikwai
Created December 6, 2023 22:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anikwai/b01eb1dff44e098dbe45282d61f0f066 to your computer and use it in GitHub Desktop.
Save anikwai/b01eb1dff44e098dbe45282d61f0f066 to your computer and use it in GitHub Desktop.
How to install powershell on mac

How to install Windows Powershell on Macosx

You need brew installed on your Mac inorder to install powershell. Get brew from https://brew.sh or download it from here https://github.com/Homebrew/brew/releases/tag/4.1.24

On Mac copy the script below and paste in your terminal - it is that simple.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Install Powershell

Follow instruction on this website - https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-macos?view=powershell-7.4

Install using this script: brew install powershell/tap/powershell

Check if it is installed successfully using this command: pwsh

Here is a full terminal output on my MBA M2:

watsoncyrusanikwai@Watsons-Air ~ % brew install powershell/tap/powershell
Running `brew update --auto-update`...
==> Downloading https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:d783cbeb6e6ef0d71c0b442317b54554370decd6fac66bf2d4938c07a63f67be
######################################################################### 100.0%
==> Pouring portable-ruby-3.1.4.arm64_big_sur.bottle.tar.gz
==> Auto-updated Homebrew!
Updated 3 taps (homebrew/services, homebrew/core and homebrew/cask).
==> New Formulae
action-validator                         python-dicttoxml
ain                                      python-distlib
ali                                      python-distro
amass                                    python-docopt
ansible@8                                python-filelock
apkleaks                                 python-hatch-fancy-pypi-readme
appstream                                python-hatch-vcs
asitop                                   python-hatchling
authz0                                   python-idna
awscli-local                             python-jinja
bao                                      python-jmespath
biodiff                                  python-json5
bkcrack                                  python-kiwisolver
bomber                                   python-magic
bounceback                               python-mako
certgraph                                python-markdown-it-py
certsync                                 python-matplotlib
cfripper                                 python-mdurl
chainsaw                                 python-mpmath
cherrybomb                               python-msgpack
cidr                                     python-networkx
cliam                                    python-oauthlib
dalfox                                   python-openapi3
der-ascii                                python-pathspec
dicebear                                 python-pbr
dockerfile-language-server               python-platformdirs
doppler                                  python-pluggy
faircamp                                 python-ply
flyscrape                                python-prompt-toolkit
frozen                                   python-regex
gdrive@2                                 python-requests
geoip2fast                               python-requests-oauthlib
ghc@9.6                                  python-rich
goresym                                  python-s3transfer
graphqlviz                               python-setuptools-scm
instaloader                              python-sympy
intercept                                python-termcolor
invoice                                  python-trove-classifiers
kew                                      python-urllib3
libconfini                               python-wcwidth
libcyaml                                 python-websocket-client
libdpp                                   python-xlsxwriter
libjuice                                 qbittorrent-cli
libsail                                  rapidfuzz-cpp
mariadb@11.1                             rdap
mediamtx                                 redwax-tool
memray                                   reflex
minder                                   regclient
noir                                     retry
ocaml@4                                  richgo
orbuculum                                ruler
osctrl-cli                               scarb
oslo                                     scikit-image
patat                                    shell2http
pdfalyzer                                shellspec
pdfrip                                   signmykey
php@8.2                                  skate
phylum-cli                               sloth
presenterm                               snakeviz
python-abseil                            solo2-cli
python-anytree                           spglib
python-asn1crypto                        spicetify-cli
python-attrs                             spidermonkey@91
python-boto3                             sqlfmt
python-botocore                          squealer
python-brotli                            telegram-downloader
python-cachetools                        terraform-local
python-chardet                           texttest
python-charset-normalizer                tlrc
python-cli-helpers                       vet
python-colorama                          virtctl
python-configargparse                    witness
python-configobj                         xnvme
python-cycler                            yatas
python-dateutil
==> New Casks
amie                                     mindmac
bezel                                    mitmproxy
brightintosh                             navigraph-charts
btp                                      navigraph-simlink
cardo-update                             notes-better
clibor                                   nx-studio
codewhisperer                            october
deskpad                                  ok-json
douyin-chat                              orka3
effect-house                             ovito
focusrite-control-2                      ovito-pro
greenery                                 proton-drive
hapigo                                   rode-central
hides                                    senabluetoothdevicemanager
hoppscotch                               timemachinestatus
jazz2-resurrection                       tunetag
keymapp                                  vimcal
libndi                                   wave
macgpt                                   wiso-steuer-2024
mdb-accdb-viewer                         xliff-editor
mediamate

You have 7 outdated formulae installed.

==> Tapping powershell/tap
Cloning into '/opt/homebrew/Library/Taps/powershell/homebrew-tap'...
remote: Enumerating objects: 2617, done.
remote: Counting objects: 100% (641/641), done.
remote: Compressing objects: 100% (61/61), done.
remote: Total 2617 (delta 607), reused 604 (delta 580), pack-reused 1976
Receiving objects: 100% (2617/2617), 609.43 KiB | 2.45 MiB/s, done.
Resolving deltas: 100% (1821/1821), done.
Tapped 4 formulae (36 files, 731.3KB).
==> Fetching powershell/tap/powershell
==> Downloading https://github.com/PowerShell/PowerShell/releases/download/v7.4.
==> Downloading from https://objects.githubusercontent.com/github-production-rel
######################################################################### 100.0%
==> Installing powershell from powershell/tap
==> Caveats
The executable should already be on PATH so run with `pwsh`. If not, the full path to the executable is:
  /opt/homebrew/opt/powershell/bin/pwsh

Other application files were installed at :
  /opt/homebrew/opt/powershell/libexec

If you also have the Cask installed, you need to run the following to make the formula your default install:
  brew link --overwrite powershell

If you would like to make PowerShell your default shell, run
  sudo sh -c "echo '/opt/homebrew/opt/powershell/bin/pwsh' >> /etc/shells"
  chsh -s /opt/homebrew/opt/powershell/bin/pwsh
==> Summary
🍺  /opt/homebrew/Cellar/powershell/7.4.0: 621 files, 187.2MB, built in 6 seconds
==> Running `brew cleanup powershell`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> `brew cleanup` has not been run in the last 30 days, running now...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Removing: /Users/watsoncyrusanikwai/Library/Caches/Homebrew/openssl@3--3.1.4... (7.7MB)
Removing: /Users/watsoncyrusanikwai/Library/Caches/Homebrew/pipenv--2023.10.24... (2.8MB)
Removing: /Users/watsoncyrusanikwai/Library/Caches/Homebrew/python-certifi--2023.7.22_1... (5.4KB)
Removing: /Users/watsoncyrusanikwai/Library/Caches/Homebrew/readline--8.2.1... (574.3KB)
Removing: /Users/watsoncyrusanikwai/Library/Caches/Homebrew/sqlite--3.43.2... (2.1MB)
Removing: /Users/watsoncyrusanikwai/Library/Caches/Homebrew/virtualenv--20.24.6_1... (4MB)
Removing: /Users/watsoncyrusanikwai/Library/Caches/Homebrew/xz--5.4.4... (660.4KB)
Removing: /Users/watsoncyrusanikwai/Library/Logs/Homebrew/pipenv... (64B)
Removing: /Users/watsoncyrusanikwai/Library/Logs/Homebrew/python@3.12... (2 files, 2KB)
Removing: /Users/watsoncyrusanikwai/Library/Logs/Homebrew/openssl@3... (64B)
Removing: /Users/watsoncyrusanikwai/Library/Logs/Homebrew/ca-certificates... (64B)
Pruned 0 symbolic links and 2 directories from /opt/homebrew
watsoncyrusanikwai@Watsons-Air ~ % pwsh
PowerShell 7.4.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment