# Install gh with Homebrew, chocolatey, apt, dnf, MacPorts, Nix, scoop, winget, zypper

GitHub command-line tool. Version 2.96.0 via Homebrew; verified 2026-07-03.

## Install

```sh
sudo av install brew:gh
```

## Agent safety answer

gh is the GitHub control-plane CLI for repositories, releases, issues, and authenticated developer state.

- **Credential access:** Reads GitHub CLI tokens and can print or use them for API calls.
- **Remote mutation:** Can modify repositories, pull requests, releases, secrets, and organization state.
- **Publish/artifact risk:** Can create releases, upload assets, and trigger release automation.
- **Recommended control:** Use GitHub token protection plus approval gates for write and token-display commands.
- **Agent-use guidance:** Permit status and read-only queries; require approval for token output, release creation, repo writes, and workflow dispatch.

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install gh
```

  Evidence: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install gh
```

  Evidence: MacPorts ports tree: devel/gh/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- Debian apt (92%):

```sh
sudo apt install gh
```

  Evidence: Debian stable package indexes: gh from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- dnf (92%):

```sh
sudo dnf install gh
```

  Evidence: Fedora Rawhide package metadata: gh from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/e5ca8ce900cd68f5419e1c39ae517343100b306336cbaeb70a3c153121d95094-primary.xml.zst

- Nix (92%):

```sh
nix profile install nixpkgs#gh
```

  Evidence: nixpkgs package indexes: pkgs/by-name/gh/gh/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- zypper (92%):

```sh
sudo zypper install gh
```

  Evidence: openSUSE Tumbleweed package metadata: gh from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst

### Windows

- Chocolatey (92%):

```sh
choco install gh
```

  Evidence: Chocolatey community package catalog: gh from http://community.chocolatey.org/api/v2/Packages?$filter=IsLatestVersion&$select=Id&$top=1000&$skiptoken='11','gawk'

- Scoop (92%):

```sh
scoop install main/gh
```

  Evidence: Scoop official bucket manifest trees: bucket/gh.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1

- winget (92%):

```sh
winget install --id GitHub.cli -e
```

  Evidence: Windows Package Manager source index: GitHub.cli from https://cdn.winget.microsoft.com/cache/source.msix

## Package facts

- **Package key:** brew:gh
- **Package manager:** Homebrew
- **Package manager page:** <https://formulae.brew.sh/formula/gh>
- **Version:** 2.96.0
- **Source summary:** GitHub command-line tool
- **Homepage:** <https://cli.github.com/>
- **Repository:** <https://github.com/cli/cli>
- **Upstream docs:** <https://cli.github.com/manual/gh>
- **License:** MIT
- **Source archive:** <https://github.com/cli/cli/archive/refs/tags/v2.96.0.tar.gz>
- **Last updated:** 2026-07-03T00:29:16Z
- **Generated:** 2026-07-08T07:18:31+00:00

## Executables

- gh (cli)
- gh (alias)

## Build dependencies

- go

## Install behavior

- Post-install hook: not defined
- Bottle: available on arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, sonoma, x86_64_linux

## Freshness

- Page generated: 2026-07-08
- Package-manager version: 2.96.0
- Package-manager updated: 2026-07-03
- Local data: ok
- Upstream repository: https://github.com/cli/cli
- Upstream latest detected: v2.96.0 (current)
## Project history and usage

GitHub CLI, invoked as `gh`, is GitHub's official command-line tool for working with pull requests, issues, repositories, releases, Actions, authentication, and GitHub API data from a terminal.

### Project history

GitHub created the cli/cli repository in October 2019 and opened the project as a new official CLI distinct from the older community `hub` tool. GitHub announced the beta in February 2020 and released GitHub CLI 1.0 in September 2020.

The README frames `gh` as a standalone tool that brings GitHub concepts next to `git` and source code work. The project grew into a cross-platform Go CLI with first-party manuals, release binaries, package repositories, GitHub Enterprise support, extension support, API helpers, and later supply-chain features such as build provenance attestations for release artifacts.

### Adoption history

GitHub CLI has broad adoption because it is distributed through GitHub's own package repositories and release binaries, package managers such as Homebrew and WinGet, and GitHub-hosted Actions runner images. Its first-party status made it a standard automation interface for GitHub workflows in shells and CI jobs.

### How it is used

Practitioners use `gh` to create and review pull requests, triage issues, clone and browse repositories, trigger or inspect Actions workflows, manage releases and gists, authenticate to GitHub hosts, call the GitHub API, and script repository operations without leaving the command line.

### Why package nerds care

For package and automation ecosystems, `gh` is important because it gives GitHub an official, versioned executable surface. Package maintainers can depend on consistent commands across macOS, Linux, and Windows, while CI authors can use a preinstalled or easily installed binary instead of hand-rolling API calls.

### Timeline

- 2019: The cli/cli repository was created.
- 2020: GitHub announced GitHub CLI beta.
- 2020: GitHub CLI 1.0.0 was published.
- 2024: The README records release build provenance attestations beginning with version 2.50.0.

### Related projects

- The README compares GitHub CLI with `hub`, noting that `hub` behaves as a proxy to `git` while `gh` is a standalone tool for GitHub workflows.

### Sources

- <https://api.github.com/repos/cli/cli>
- <https://api.github.com/repos/cli/cli/releases>
- <https://cli.github.com/manual/gh>
- <https://docs.github.com/en/github-cli/github-cli/about-github-cli>
- <https://formulae.brew.sh/formula/gh>
- <https://github.blog/2020-02-12-supercharge-your-command-line-experience-github-cli-is-now-in-beta/>
- <https://github.blog/2020-09-17-github-cli-1-0-is-now-available/>
- <https://github.com/cli/cli>
- <https://raw.githubusercontent.com/cli/cli/trunk/README.md>


## Security Notes

broad networked developer tool.

- **Geiger risk:** blue / high
- broad networked developer tool
- **Approval gate rules:** 7


## Configuration and credential file locations

These source-backed paths show where this package keeps local settings or durable credentials. Automic Vault can use them as review targets for secret scanning, migration, and command approval.


## Configuration files

- Unix: $XDG_CONFIG_HOME/gh/config.yml, ~/.config/gh/config.yml
- Windows: %AppData%\GitHub CLI\config.yml

## Credential files

- Unix: $XDG_CONFIG_HOME/gh/hosts.yml, ~/.config/gh/hosts.yml
- Windows: %AppData%\GitHub CLI\hosts.yml
## Source Database Details

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** gh
- **Version Scheme:** 0
- **Revision:** 0
- **Head Version:** HEAD
- **Bottle Stable Root URL:** <https://ghcr.io/v2/homebrew/core>
- **Deprecated:** no
- **Disabled:** no
- **Keg Only:** no
- **URL Keys:** head, stable

## Other Package-Manager Records

- Debian apt - gh - 2.46.0-3: normalized package name match | Debian stable package indexes: gh from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | GitHub CLI, GitHub’s official command line tool | https://cli.github.com/
- Nix - gh: normalized package name match | nixpkgs package indexes: pkgs/by-name/gh/gh/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - gh - 2.45.0-1build1: normalized package name match | Ubuntu 24.04 LTS package indexes: gh from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | GitHub CLI, GitHub’s official command line tool | https://cli.github.com/
- dnf - gh - 2.93.0-1.fc45: normalized package name match | Fedora Rawhide package metadata: gh from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/e5ca8ce900cd68f5419e1c39ae517343100b306336cbaeb70a3c153121d95094-primary.xml.zst | GitHub's official command line tool | https://github.com/cli/cli
- zypper - gh - 2.93.0-1.1: normalized package name match | openSUSE Tumbleweed package metadata: gh from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst | The official CLI for GitHub | https://cli.github.com/
- zypper - gh-bash-completion - 2.93.0-1.1: normalized package name match | openSUSE Tumbleweed package metadata: gh-bash-completion from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst | Bash Completion for gh | https://cli.github.com/
- zypper - gh-fish-completion - 2.93.0-1.1: normalized package name match | openSUSE Tumbleweed package metadata: gh-fish-completion from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst | Fish completion for gh | https://cli.github.com/
- zypper - gh-zsh-completion - 2.93.0-1.1: normalized package name match | openSUSE Tumbleweed package metadata: gh-zsh-completion from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst | ZSH Completion for gh | https://cli.github.com/
- MacPorts - gh: normalized package name match | MacPorts ports tree: devel/gh/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1
- Chocolatey - gh: normalized package name match | Chocolatey community package catalog: gh from http://community.chocolatey.org/api/v2/Packages?$filter=IsLatestVersion&$select=Id&$top=1000&$skiptoken='11','gawk'
- Scoop - main/gh: normalized package name match | Scoop official bucket manifest trees: bucket/gh.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1
- winget - GitHub.cli: normalized package name match | Windows Package Manager source index: GitHub.cli from https://cdn.winget.microsoft.com/cache/source.msix


## Related links

- [Source-control packages](https://www.automicvault.com/pkg/source-control-tools/) - Belongs to a source-control command family.
- [Secret-risk packages](https://www.automicvault.com/pkg/secret-risk-packages/) - Has protected-tool coverage, approval-gate, or non-low Geiger security signals.
- [Terminal utility packages](https://www.automicvault.com/pkg/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Text processing packages](https://www.automicvault.com/pkg/text-processing-tools/) - Matched text, document, or structured-data processing metadata.
- [go](https://www.automicvault.com/pkg/brew/go/) - Build dependency declared by Homebrew.
- [sapling](https://www.automicvault.com/pkg/brew/sapling/) - Popular package that depends on this formula.
- [sugarjar](https://www.automicvault.com/pkg/brew/sugarjar/) - Popular package that depends on this formula.
- [hub](https://www.automicvault.com/pkg/brew/hub/) - Shares av.db curated category or tags: cli, developer-tools, git, github, github-cli.
- [git-xargs](https://www.automicvault.com/pkg/brew/git-xargs/) - Shares av.db curated category or tags: automation, cli, developer-tools, git, github.
- [gcli](https://www.automicvault.com/pkg/brew/gcli/) - Shares av.db curated category or tags: cli, developer-tools, git, github, version-control.
- [ggc](https://www.automicvault.com/pkg/brew/ggc/) - Shares av.db curated category or tags: cli, developer-tools, git, version-control.
- [git-open](https://www.automicvault.com/pkg/brew/git-open/) - Shares av.db curated category or tags: cli, developer-tools, git, github, version-control.
- [git-spice](https://www.automicvault.com/pkg/brew/git-spice/) - Shares av.db curated category or tags: cli, developer-tools, git, github, version-control.
- [gitbackup](https://www.automicvault.com/pkg/brew/gitbackup/) - Shares av.db curated category or tags: cli, developer-tools, git, github, version-control.
- [gitup](https://www.automicvault.com/pkg/brew/gitup/) - Shares av.db curated category or tags: automation, cli, developer-tools, git, version-control.
- [git-cal](https://www.automicvault.com/pkg/brew/git-cal/) - Local package facts share a topical domain. Shared terms: cli, command-line, control, developer, developer-tools.

## Combined YAML source

View the package source record on GitHub. [combined/gh.yml](https://github.com/automic-vault/db/blob/main/combined/gh.yml)


## Sources

- Nucleus package database
- Geiger risk classifier
- approval-gate seed metadata
- package-page enrichment
- curated configuration and credential file locations
- curated package history
- package version freshness
- av.db category and tag curation
- package relationship graph
- external package-manager database matches
- cross-ecosystem install command graph
- curated agent safety answer
