macOS でPowerShellを使えるようにする

PowerShell

Homebrewをインストール

Homebrew を使用してインストールする。 Homebrew は、macOS 用の推奨されるパッケージ マネージャーです。

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
==> Checking for `sudo` access (which may request your password)...
Password:
==> You are using macOS 10.15.
==> We (and Apple) do not provide support for this old version.
This installation may not succeed.
After installation, you will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Twitter or any other official channels. You are responsible for resolving any
issues you experience while you are running this old version.

==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜

PowerShell の最新の安定板リリースをインストール

brew がインストールされたら、PowerShell をインストール

brew install powershell/tap/powershell
==> Tapping powershell/tap
Cloning into '/usr/local/Homebrew/Library/Taps/powershell/homebrew-tap'...
remote: Enumerating objects: 2648, done.
remote: Counting objects: 100% (672/672), done.
remote: Compressing objects: 100% (72/72), done.
remote: Total 2648 (delta 625), reused 631 (delta 600), pack-reused 1976 (from 1)
Receiving objects: 100% (2648/2648), 620.58 KiB | 1.03 MiB/s, done.
Resolving deltas: 100% (1840/1840), done.
Tapped 4 formulae (38 files, 746.3KB).
Warning: You are using macOS 10.15.
We (and Apple) do not provide support for this old version.
It is expected behaviour that some formulae will fail to build in this old version.
It is expected behaviour that Homebrew will be buggy and slow.
Do not create any issues about this on Homebrew's GitHub repositories.
Do not create any issues even if you think this message is unrelated.
Any opened issues will be immediately closed without response.
Do not ask for help from Homebrew or its maintainers on social media.
You may ask for help in Homebrew's discussions but are unlikely to receive a response.
Try to figure out the problem yourself and submit a fix as a pull request.
We will review it but may or may not accept it.

==> 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:
  /usr/local/opt/powershell/bin/pwsh

Other application files were installed at :
  /usr/local/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 '/usr/local/opt/powershell/bin/pwsh' >> /etc/shells"
  chsh -s /usr/local/opt/powershell/bin/pwsh
==> Summary
🍺  /usr/local/Cellar/powershell/7.4.5: 614 files, 172.4MB, built in 40 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`).

インストールが正常に動作していることを確認

pwsh
PowerShell 7.4.5

Homebrew の式を更新し、PowerShell をアップグレード

brew update
brew upgrade powershell

コメント