pwsh-termux

Install

Four commands, then pkg keeps PowerShell up to date.

Requirements

Steps

  1. Add the repository’s signing key:

    curl -fsSL https://pwsh-termux.machlev.org/pwsh-termux.gpg \
      -o $PREFIX/etc/apt/trusted.gpg.d/pwsh-termux.gpg
  2. Add the repository:

    echo "deb https://pwsh-termux.machlev.org stable main" \
      > $PREFIX/etc/apt/sources.list.d/pwsh-termux.list
  3. Install:

    pkg update
    pkg install pwsh
  4. Run it:

    pwsh
    $PSVersionTable.PSVersion

For the preview channel, pkg install pwsh-preview installs pwsh-preview next to pwsh. It only exists while Microsoft’s newest preview is newer than the newest stable release.

Check the signing key

The key you downloaded should have this fingerprint (compare it with the one in the security policy on GitHub, which is a separate channel):

7086 C70B 4A25 576F E0C0  CE77 E43F B41F 02D0 1FC8

To see it yourself: pkg install gnupg, then gpg --show-keys $PREFIX/etc/apt/trusted.gpg.d/pwsh-termux.gpg.

Update and remove

pkg upgrade            # updates everything, including pwsh
pkg remove pwsh        # remove PowerShell

To also drop the repository: delete $PREFIX/etc/apt/sources.list.d/pwsh-termux.list and $PREFIX/etc/apt/trusted.gpg.d/pwsh-termux.gpg.

If something goes wrong

SymptomCause and fix
pkg update says NO_PUBKEY or the repository is not signedThe key from step 1 is missing or empty. Repeat step 1 and check the file is not an error page.
Unable to locate package pwshStep 2 was skipped, or pkg update was not run afterwards.
depends on glibc, but it is not installableThe glibc repository is not enabled: pkg install glibc-repo, then pkg update.
Installed but pwsh says it cannot execute or a library is missingRun pkg install --reinstall pwsh; if it persists, open an issue with the output of pkg list-installed | grep -E 'glibc|icu|pwsh'.

About PowerShell’s own behavior

This package does not change PowerShell. Microsoft’s build collects usage telemetry unless you opt out, and it can print a notice about newer versions. To turn both off, add to ~/.bashrc (or your shell’s file):

export POWERSHELL_TELEMETRY_OPTOUT=1
export POWERSHELL_UPDATECHECK=Off