github.com/abdfnx/gh-api@v0.0.0-20210414084727-f5432eec23b8/docs/install_linux.md (about)

     1  # Installing gh on Linux and FreeBSD
     2  
     3  Packages downloaded from https://cli.github.com or from https://github.com/cli/cli/releases
     4  are considered official binaries. We focus on popular Linux distros and
     5  the following CPU architectures: `i386`, `amd64`, `arm64`.
     6  
     7  Other sources for installation are community-maintained and thus might lag behind
     8  our release schedule.
     9  
    10  If none of our official binaries, packages, repositories, nor community sources work for you, we recommend using our `Makefile` to build `gh` from source. It's quick and easy.
    11  
    12  ## Official sources
    13  
    14  ### Debian, Ubuntu Linux (apt)
    15  
    16  Install:
    17  
    18  ```bash
    19  sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0
    20  sudo apt-add-repository https://cli.github.com/packages
    21  sudo apt update
    22  sudo apt install gh
    23  ```
    24  
    25  **Note**: If you are behind a firewall, the connection to `keyserver.ubuntu.com` might fail. In that case, try running `sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C99B11DEB97541F0`.
    26  
    27  **Note**: If you get _"gpg: failed to start the dirmngr '/usr/bin/dirmngr': No such file or directory"_ error, try installing the `dirmngr` package. Run `sudo apt-get install dirmngr` and repeat the steps above.  
    28  
    29  **Note**: most systems will have `apt-add-repository` already. If you get a _command not found_
    30  error, try running `sudo apt install software-properties-common` and trying these steps again.
    31  
    32  
    33  Upgrade:
    34  
    35  ```bash
    36  sudo apt update
    37  sudo apt install gh
    38  ```
    39  
    40  ### Fedora, CentOS, Red Hat Enterprise Linux (dnf)
    41  
    42  Install:
    43  
    44  ```bash
    45  sudo dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
    46  sudo dnf install gh
    47  ```
    48  
    49  Upgrade:
    50  
    51  ```bash
    52  sudo dnf update gh
    53  ```
    54  
    55  ### openSUSE/SUSE Linux (zypper)
    56  
    57  Install:
    58  
    59  ```bash
    60  sudo zypper addrepo https://cli.github.com/packages/rpm/gh-cli.repo
    61  sudo zypper ref
    62  sudo zypper install gh
    63  ```
    64  
    65  Upgrade:
    66  
    67  ```bash
    68  sudo zypper ref
    69  sudo zypper update gh
    70  ```
    71  
    72  ## Manual installation
    73  
    74  * [Download release binaries][releases page] that match your platform; or
    75  * [Build from source](./source.md).
    76  
    77  ### openSUSE/SUSE Linux (zypper)
    78   
    79  Install and upgrade:
    80  
    81  1. Download the `.rpm` file from the [releases page][];
    82  2. Install the downloaded file: `sudo zypper in gh_*_linux_amd64.rpm`
    83  
    84  ## Unofficial, Community-supported methods
    85  
    86  The core GitHub CLI team does not maintain the following packages or repositories. They are unofficial and we are unable to provide support or guarantees for them. They are linked here as a convenience and their presence does not imply continued oversight from the CLI core team. Users who choose to use them do so at their own risk.
    87  
    88  ### Arch Linux
    89  
    90  Arch Linux users can install from the [community repo][arch linux repo]:
    91  
    92  ```bash
    93  sudo pacman -S github-cli
    94  ```
    95  
    96  Alternatively, use the [unofficial AUR package][arch linux aur] to build GitHub CLI from source.
    97  
    98  ### Android
    99  
   100  Android 7+ users can install via [Termux](https://wiki.termux.com/wiki/Main_Page):
   101  
   102  ```bash
   103  pkg install gh
   104  ```
   105  
   106  ### FreeBSD
   107  
   108  FreeBSD users can install from the [ports collection](https://www.freshports.org/devel/gh/):
   109  
   110  ```bash
   111  cd /usr/ports/devel/gh/ && make install clean
   112  ```
   113  
   114  Or via [pkg(8)](https://www.freebsd.org/cgi/man.cgi?pkg(8)):
   115  
   116  ```bash
   117  pkg install gh
   118  ```
   119  
   120  ### Gentoo
   121  
   122  Gentoo Linux users can install from the [main portage tree](https://packages.gentoo.org/packages/dev-util/github-cli):
   123  
   124  ``` bash
   125  emerge -av github-cli
   126  ```
   127  
   128  Upgrading can be done by updating the portage tree and then requesting an upgrade:
   129  
   130  ``` bash
   131  emerge --sync
   132  emerge -u github-cli
   133  ```
   134  
   135  ### Kiss Linux
   136  
   137  Kiss Linux users can install from the [community repos](https://github.com/kisslinux/community):
   138  
   139  ```bash
   140  kiss b github-cli && kiss i github-cli
   141  ```
   142  
   143  ### Nix/NixOS
   144  
   145  Nix/NixOS users can install from [nixpkgs](https://search.nixos.org/packages?show=gitAndTools.gh&query=gh&from=0&size=30&sort=relevance&channel=20.03#disabled):
   146  
   147  ```bash
   148  nix-env -iA nixos.gitAndTools.gh
   149  ```
   150  
   151  ### openSUSE Tumbleweed
   152  
   153  openSUSE Tumbleweed users can install from the [offical distribution repo](https://software.opensuse.org/package/gh):
   154  ```bash
   155  sudo zypper in gh
   156  ```
   157  
   158  ### Snaps
   159  
   160  Many Linux distro users can install using Snapd from the [Snap Store](https://snapcraft.io/gh) or the associated [repo](https://github.com/casperdcl/cli/tree/snap)
   161  
   162  ```bash
   163  sudo snap install --edge gh && snap connect gh:ssh-keys
   164  ```
   165  > Snaps are auto-updated every 6 hours. `Snapd` is required and is available on a wide range of Linux distros.
   166  > Find out which distros have Snapd pre-installed and how to install it in the [Snapcraft Installation Docs](https://snapcraft.io/docs/installing-snapd)
   167  >
   168  > **Note:** `snap connect gh:ssh-keys` is needed for all authentication and SSH needs.
   169  
   170  [releases page]: https://github.com/cli/cli/releases/latest
   171  [arch linux repo]: https://www.archlinux.org/packages/community/x86_64/github-cli
   172  [arch linux aur]: https://aur.archlinux.org/packages/github-cli-git