Installation

macOS

gh is available via Homebrew and MacPorts.

Homebrew

Install:

brew install github/gh/gh

Upgrade:

brew upgrade gh

MacPorts

Install:

sudo port install gh

Upgrade:

sudo port selfupdate && sudo port upgrade gh

Windows

gh is available via scoop, Chocolatey, and as downloadable MSI.

scoop

Install:

scoop bucket add github-gh https://github.com/cli/scoop-gh.git
scoop install gh

Upgrade:

scoop update gh

Chocolatey

Install:

choco install gh

Upgrade:

choco upgrade gh

Signed MSI

MSI installers are available for download on the releases page.

Debian/Ubuntu Linux

Install and upgrade:

  1. Download the .deb file from the releases page
  2. sudo apt install ./gh_*_linux_amd64.deb install the downloaded file

Fedora Linux

Install and upgrade:

  1. Download the .rpm file from the releases page
  2. sudo dnf install gh_*_linux_amd64.rpm install the downloaded file

Centos Linux

Install and upgrade:

  1. Download the .rpm file from the releases page
  2. sudo yum localinstall gh_*_linux_amd64.rpm install the downloaded file

openSUSE/SUSE Linux

Install and upgrade:

  1. Download the .rpm file from the releases page
  2. sudo zypper in gh_*_linux_amd64.rpm install the downloaded file

Arch Linux

Arch Linux users can install from the AUR: https://aur.archlinux.org/packages/github-cli/

yay -S github-cli

Other platforms

Install a prebuilt binary from the releases page

Setting an editor

To set your preferred editor, you can use gh config set [editor]. Read more about gh config.

Additionally if the above is not set, for macOS and Linux,gh will respect the following environment variables, in this order, based on your OS and shell setup:

  1. GIT_EDITOR
  2. VISUAL
  3. EDITOR

On Windows, the editor will currently always be Notepad.