Back to Cli

Installing gh on Linux and BSD

docs/install_linux.md

2.92.014.2 KB
Original Source

Installing gh on Linux and BSD

[!IMPORTANT] Our Linux packages and repository metadata are signed with the following PGP key fingerprints:

  • 2C6106201985B60E6C7AC87323F3D4EA75716059
  • 7F38BBB59D064DBCB3D84D725612B36462313325

You may be prompted to confirm the import of these keys during installation.

<details><summary>Expand for SHA256/SHA512/MD5 checksums of our official keyring files.</summary> <p>

For security reasons, it is strongly recommended to only rely on SHA256/SHA512 checksums. MD5 checksums below are only for legacy systems where SHA256/SHA512 tooling is not available.

  • https://cli.github.com/packages/githubcli-archive-keyring.gpg (Binary):
    SHA256: 6084d5d7bd8e288441e0e94fc6275570895da18e6751f70f057485dc2d1a811b
    SHA512: ce6b9466dbd2a90b3227e177aa9b8187bd2405b1c29f91d78de83b9699dbbe2af35efd733bf53da622e7a38c59a7bc55539d63a3deae3c9ff9c2bff8af626434
    MD5:    23748c0965069fb1edae1b83c17890e1
    
  • https://cli.github.com/packages/githubcli-archive-keyring.asc (ASCII-armored):
    SHA256: cec6e9ed82d3949ca5f4428cc968b41ef5e7416cb3653cdfc2a421977663bbfd
    SHA512: 2ca9487d88a508a1c87f06b46ba336b11cc5f20bd83915b4c2acde49d2cffbbce76af1641bf8494c29a765f96bc1fd694ebde2954b28b80dcc76376b6f1b766d
    MD5:    97100400ef48007b69e42be348cc6582
    
</p> </details>

Debian

Debian packages are hosted on the GitHub CLI marketing site for various operating systems including:

These packages are supported by the GitHub CLI maintainers with updates powered by GitHub CLI deployment workflow.

To install:

bash
(type -p wget >/dev/null || (sudo apt update && sudo apt install wget -y)) \
	&& sudo mkdir -p -m 755 /etc/apt/keyrings \
	&& out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \
	&& cat $out | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
	&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
	&& sudo mkdir -p -m 755 /etc/apt/sources.list.d \
	&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
	&& sudo apt update \
	&& sudo apt install gh -y

To upgrade:

bash
sudo apt update
sudo apt install gh

[!TIP] To verify PGP keys before installing gh, you can run this and match the listed fingerprints with those at the top of this document:

shell
curl -fsSL -o - https://cli.github.com/packages/githubcli-archive-keyring.gpg | gpg --show-keys

RPM

RPM packages are hosted on the GitHub CLI marketing site for various operating systems including:

These packages are supported by the GitHub CLI maintainers with updates powered by GitHub CLI deployment workflow.

[!TIP] During installation, you may be prompted to confirm the import of PGP keys. You can verify the keys with the list of fingerprints at the top of this document.

To verify the PGP keys before installing gh, you can run the following command and match the listed fingerprints with those at the top of this document:

shell
curl -fsSL -o - https://cli.github.com/packages/githubcli-archive-keyring.asc | gpg --show-keys

DNF5

[!IMPORTANT] These commands apply to DNF5 only. If you're using DNF4, please use the DNF4 instructions.

To install:

bash
sudo dnf install dnf5-plugins
sudo dnf config-manager addrepo --from-repofile=https://cli.github.com/packages/rpm/gh-cli.repo
sudo dnf install gh --repo gh-cli

To upgrade:

bash
sudo dnf update gh

DNF4

[!IMPORTANT] These commands apply to DNF4 only. If you're using DNF5, please use the DNF5 instructions.

To install:

bash
sudo dnf install 'dnf-command(config-manager)'
sudo dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
sudo dnf install gh --repo gh-cli

To upgrade:

bash
sudo dnf update gh

Amazon Linux 2 (yum)

To install:

bash
type -p yum-config-manager >/dev/null || sudo yum install yum-utils
sudo yum-config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
sudo yum install gh

To upgrade:

bash
sudo yum update gh

openSUSE/SUSE Linux (zypper)

To install:

bash
sudo zypper addrepo https://cli.github.com/packages/rpm/gh-cli.repo
sudo zypper ref
sudo zypper install gh

To upgrade:

bash
sudo zypper ref
sudo zypper update gh

Homebrew

Homebrew is a free and open-source software package management system that simplifies the installation of software on Apple's operating system, macOS, as well as Linux.

The GitHub CLI formulae is supported by the GitHub CLI maintainers with help from our friends at Homebrew with updates powered by homebrew/hoomebrew-core.

To install:

shell
brew install gh

To upgrade:

shell
brew upgrade gh

Precompiled binaries

GitHub CLI releases contain precompiled binaries for 386, amd64, arm64, and armv6 architectures.

Community (Unofficial)

[!IMPORTANT] The GitHub CLI team does not maintain the following packages or repositories. We are unable to provide support for these installation methods or any guarantees of stability, security, or availability for these installation methods.

Alpine Linux

The GitHub CLI package is supported by the Alpine Linux community with updates powered by alpine/aports.

To install stable release:

bash
apk add github-cli

To install edge release:

bash
echo "@community http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
apk add github-cli@community

Android

The GitHub CLI package is supported by the Termux community with updates powered by termux/termux-packages.

To install and upgrade:

bash
pkg install gh

Arch Linux

The GitHub CLI package is supported by the Arch Linux community with updates powered by Arch Linux packaging.

To install:

bash
sudo pacman -S github-cli

To upgrade all packages:

bash
sudo pacman -Syu

Alternatively, use the unofficial AUR package to build GitHub CLI from source.

Conda

Conda is an open source package management system and environment management system for installing multiple versions of software packages and their dependencies and switching easily between them. It works on Linux, OS X and Windows, and was created for Python programs but can package and distribute any software.

The GitHub CLI package is supported by the Conda community with updates powered by conda-forge/gh-feedstock.

To install:

shell
conda install gh --channel conda-forge

To upgrade:

shell
conda update gh --channel conda-forge

Debian Community

The GitHub CLI package is supported by the Debian community with updates powered by Debian Go Packaging Team.

[!NOTE] As of November 2025, GitHub CLI maintainers strongly recommend official Debian packages especially as the community-distributed 2.45.x / 2.46.x version is broken due to deprecated GitHub APIs.

Fedora Community

The GitHub CLI package is supported by the Fedora community with updates powered by Fedora Project.

To install:

bash
sudo dnf install gh

To upgrade:

bash
sudo dnf update gh

Flox

Flox is a virtual environment and package manager all in one. With Flox you create environments that layer and replace dependencies just where it matters, making them portable across the full software lifecycle.

Flox relies upon the GitHub CLI package supported by the NixOS community

To install:

shell
flox install gh

To upgrade:

shell
flox upgrade toplevel

FreeBSD

The GitHub CLI port is supported by the FreeBSD community with updates powered by FreeBSD ports.

bash
cd /usr/ports/devel/gh/ && make install clean

Or via pkg(8):

bash
pkg install gh

Funtoo

The GitHub CLI portage is supported by the Funtoo community with updates powered by funtoo/dev-kit.

To install:

bash
emerge -av github-cli

To upgrade:

bash
ego sync
emerge -u github-cli

Gentoo

The GitHub CLI portage is supported by the Gentoo community with updates powered by Gentoo portage.

To install:

bash
emerge -av github-cli

To upgrade:

bash
emerge --sync
emerge -u github-cli

Manjaro Linux

The GitHub CLI package is the same package produced by the Arch Linux community

To install and upgrade:

bash
pamac install github-cli

MidnightBSD

The GitHub CLI port is supported by the MidnightBSD community with updates powered by MidnightBSD/mports.

To install:

bash
cd /usr/mports/devel/gh/ && make install clean

Or via mport(1):

bash
mport install gh

NetBSD/pkgsrc

The GitHub CLI package is supported by the NetBSD community with updates powered by NetBSD/pkgsrc.

To install:

bash
pkgin install gh

Nix/NixOS

The GitHub CLI package is supported by the NixOS community with updates powered by NixOS/nixpkgs.

To install:

bash
nix-env -iA nixos.gh

OpenBSD

The GitHub CLI port is supported by the OpenBSD community with updates powered by OpenBSD ports.

To install:

shell
pkg_add github-cli

openSUSE Tumbleweed

The GitHub CLI package is supported by the openSUSE community.

To install:

bash
sudo zypper install gh

To upgrade:

bash
sudo zypper update gh

Solus Linux

The GitHub CLI package is supported by the Solus Linux community with updates powered by getsolus/packages.

To install:

bash
sudo eopkg install github-cli

Spack

Spack is a flexible package manager supporting multiple versions, configurations, platforms, and compilers for supercomputers, Linux, and macOS.

The GitHub CLI package is supported by the Spack community with updates powered by spack/spack-packages.

To install:

shell
spack install gh

To upgrade:

shell
spack uninstall gh && spack install gh

Ubuntu Community

The GitHub CLI package is synced from upstream Debian Community package.

[!NOTE] As of November 2025, GitHub CLI maintainers strongly recommend official Debian packages especially as the community-distributed 2.45.x / 2.46.x version is broken due to deprecated GitHub APIs.

Void Linux

The GitHub CLI package: is supported by the Void Linux community with updates powered by void-linux/void-packages.

To install:

bash
sudo xbps-install github-cli

Webi

Webi is a tool that aims to effortlessly install developer tools with easy-to-remember URLs from official builds quickly, without sudo or Admin, without a package manager, and without changing system file permissions.

The GitHub CLI package is supported by the Webi community with updates powered by webinstall/webi-installers.

To install:

shell
curl -sS https://webi.sh/gh \| sh

To upgrade:

shell
webi gh@stable

Discouraged

[!WARNING] The GitHub CLI team actively discourages use of the following methods of installation.

Snap

The GitHub CLI package has so many issues with Snap as a runtime mechanism for apps like GitHub CLI that our team suggests never installing gh as a snap.