🍎

Mac環境にPowershell 7をインストールする方法

に公開

はじめに

MacでPowershellを利用する方法を残しておきたい。

注意

HomebrewによるPowershellのインストールは2026/09/01をもって不可能になります。
ご注意を。

環境

  • macOS Tahoe 26.1
  • 使用ターミナル: Macのデフォルトターミナル(Homebrewインストール済み)

インストール手順

今回はHomebrewを利用してインストールする。
以下のコマンドをコピーし、任意のターミナルに貼り付け、Enterキーを押下

brew install --cask powershell

ダウンロードが始まり、しばらくするとパスワードを要求されるので、今ログインしているユーザのパスワードを入力する。

✔︎ JSON API cask.jws.json                                                                   [Downloaded   15.0MB/ 15.0MB]
✔︎ JSON API formula.jws.json                                                                [Downloaded   31.7MB/ 31.7MB]
Warning: powershell has been deprecated because it does not pass the macOS Gatekeeper check! It will be disabled on 2026-09-01.
==> Caveats
To use Homebrew in PowerShell, run the following in a PowerShell session:
  New-Item -Path (Split-Path -Parent -Path $PROFILE.CurrentUserAllHosts) -ItemType Directory -Force
  Add-Content -Path $PROFILE.CurrentUserAllHosts -Value '$(/opt/homebrew/bin/brew shellenv) | Invoke-Expression'

==> Downloading https://github.com/PowerShell/PowerShell/releases/download/v7.5.4/powershell-7.5.4-osx-arm64.pkg
==> Downloading from https://release-assets.githubusercontent.com/github-production-release-asset/49609581/991e4ec5-b666
################################################################################################################# 100.0%
==> Installing Cask powershell
==> Running installer for powershell with `sudo` (which may request your password)...
Password:

入力後、以下のような出力があれば、インストールに成功している。

installer: Package name is PowerShell - 7.5.4
installer: Installing at base path /
installer: The install was successful.
🍺  powershell was successfully installed!

導入確認

pwshを実行しバージョンが確認できれば、正常にインストールができている。

pwsh
PowerShell 7.5.4

Discussion