Install
Four commands, then pkg keeps PowerShell up to date.
Requirements
- Termux on an arm64 (aarch64) device. Check with
uname -m. - The Termux glibc repository, which provides the glibc libraries PowerShell needs:
pkg install glibc-repo. - About 200 MB of free space (the package is about 50 MB to download).
Steps
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.gpgAdd the repository:
echo "deb https://pwsh-termux.machlev.org stable main" \ > $PREFIX/etc/apt/sources.list.d/pwsh-termux.listInstall:
pkg update pkg install pwshRun 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
| Symptom | Cause and fix |
|---|---|
pkg update says NO_PUBKEY or the repository is not signed | The key from step 1 is missing or empty. Repeat step 1 and check the file is not an error page. |
Unable to locate package pwsh | Step 2 was skipped, or pkg update was not run afterwards. |
depends on glibc, but it is not installable | The glibc repository is not enabled: pkg install glibc-repo, then pkg update. |
Installed but pwsh says it cannot execute or a library is missing | Run 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