github.com/ungtb10d/cli/v2@v2.0.0-20221110210412-98537dd9d6a1/docs/install_linux.md (about) 1 # Installing gh on Linux and BSD 2 3 Packages downloaded from https://cli.github.com or from https://github.com/ungtb10d/cli/releases 4 are considered official binaries. We focus on popular Linux distros and 5 the following CPU architectures: `i386`, `amd64`, `arm64`, `armhf`. 6 7 Other sources for installation are community-maintained and thus might lag behind 8 our release schedule. 9 10 ## Official sources 11 12 ### Debian, Ubuntu Linux, Raspberry Pi OS (apt) 13 14 Install: 15 16 ```bash 17 type -p curl >/dev/null || sudo apt install curl -y 18 curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \ 19 && sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \ 20 && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ 21 && sudo apt update \ 22 && sudo apt install gh -y 23 ``` 24 25 > **Note** 26 > We were recently forced to change our GPG signing key. If you've previously downloaded the `githubcli-archive-keyring.gpg` file, you should re-download it again per above instructions. If you are using a keyserver to download the key, the ID of the new key is `23F3D4EA75716059`. 27 28 Upgrade: 29 30 ```bash 31 sudo apt update 32 sudo apt install gh 33 ``` 34 35 ### Fedora, CentOS, Red Hat Enterprise Linux (dnf) 36 37 Install from our package repository for immediate access to latest releases: 38 39 ```bash 40 sudo dnf install 'dnf-command(config-manager)' 41 sudo dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo 42 sudo dnf install gh 43 ``` 44 45 Alternatively, install from the [community repository](https://packages.fedoraproject.org/pkgs/gh/gh/): 46 47 ```bash 48 sudo dnf install gh 49 ``` 50 51 Upgrade: 52 53 ```bash 54 sudo dnf update gh 55 ``` 56 57 ### Amazon Linux 2 (yum) 58 59 Install using our package repository for immediate access to latest releases: 60 61 ```bash 62 sudo yum-config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo 63 sudo yum install gh 64 ``` 65 66 > **Note** 67 > We were recently forced to change our GPG signing key. If you've added the repository previously and now you're getting a GPG signing key error, disable the repository first with `sudo yum-config-manager --disable gh-cli` and add it again with `sudo yum-config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo`. 68 69 Upgrade: 70 71 ```bash 72 sudo yum update gh 73 ``` 74 75 ### openSUSE/SUSE Linux (zypper) 76 77 Install: 78 79 ```bash 80 sudo zypper addrepo https://cli.github.com/packages/rpm/gh-cli.repo 81 sudo zypper ref 82 sudo zypper install gh 83 ``` 84 85 Upgrade: 86 87 ```bash 88 sudo zypper ref 89 sudo zypper update gh 90 ``` 91 92 ## Manual installation 93 94 * [Download release binaries][releases page] that match your platform; or 95 * [Build from source](./source.md). 96 97 ## Unofficial, community-supported methods 98 99 The GitHub CLI team does not maintain the following packages or repositories and thus we are unable to provide support for those installation methods. 100 101 ### Snap (do not use) 102 103 There are [so many issues with Snap](https://github.com/casperdcl/cli/issues/7) as a runtime mechanism for apps like GitHub CLI that our team suggests _never installing gh as a snap_. 104 105 ### Arch Linux 106 107 Arch Linux users can install from the [community repo][arch linux repo]: 108 109 ```bash 110 sudo pacman -S github-cli 111 ``` 112 113 Alternatively, use the [unofficial AUR package][arch linux aur] to build GitHub CLI from source. 114 115 ### Android 116 117 Android 7+ users can install via [Termux](https://wiki.termux.com/wiki/Main_Page): 118 119 ```bash 120 pkg install gh 121 ``` 122 123 ### FreeBSD 124 125 FreeBSD users can install from the [ports collection](https://www.freshports.org/devel/gh/): 126 127 ```bash 128 cd /usr/ports/devel/gh/ && make install clean 129 ``` 130 131 Or via [pkg(8)](https://www.freebsd.org/cgi/man.cgi?pkg(8)): 132 133 ```bash 134 pkg install gh 135 ``` 136 137 ### NetBSD/pkgsrc 138 139 NetBSD users and those on [platforms supported by pkgsrc](https://pkgsrc.org/#index4h1) can install the [gh package](https://pkgsrc.se/net/gh): 140 141 ```bash 142 pkgin install gh 143 ``` 144 145 To install from source: 146 147 ```bash 148 cd /usr/pkgsrc/net/gh && make package-install 149 ``` 150 151 ### OpenBSD 152 153 In -current, or in releases starting from 7.0, OpenBSD users can install from packages: 154 155 ``` 156 pkg_add github-cli 157 ``` 158 159 ### Funtoo 160 161 Funtoo Linux has an autogenerated github-cli package, located in [dev-kit](https://github.com/funtoo/dev-kit/tree/1.4-release/dev-util/github-cli), which can be installed in the following way: 162 163 ``` bash 164 emerge -av github-cli 165 ``` 166 167 Upgrading can be done by syncing the repos and then requesting an upgrade: 168 169 ``` bash 170 ego sync 171 emerge -u github-cli 172 ``` 173 174 ### Gentoo 175 176 Gentoo Linux users can install from the [main portage tree](https://packages.gentoo.org/packages/dev-util/github-cli): 177 178 ``` bash 179 emerge -av github-cli 180 ``` 181 182 Upgrading can be done by updating the portage tree and then requesting an upgrade: 183 184 ``` bash 185 emerge --sync 186 emerge -u github-cli 187 ``` 188 189 ### Kiss Linux 190 191 Kiss Linux users can install from the [community repos](https://github.com/kisslinux/community): 192 193 ```bash 194 kiss b github-cli && kiss i github-cli 195 ``` 196 197 ### Nix/NixOS 198 199 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): 200 201 ```bash 202 nix-env -iA nixos.gitAndTools.gh 203 ``` 204 205 ### openSUSE Tumbleweed 206 207 openSUSE Tumbleweed users can install from the [official distribution repo](https://software.opensuse.org/package/gh): 208 ```bash 209 sudo zypper in gh 210 ``` 211 212 ### Alpine Linux 213 214 Alpine Linux users can install from the [stable releases' community package repository](https://pkgs.alpinelinux.org/packages?name=github-cli&branch=v3.15). 215 216 ```bash 217 apk add github-cli 218 ``` 219 220 Users wanting the latest version of the CLI without waiting to be backported into the stable release they're using should use the edge release's 221 community repo through this method below, without mixing packages from stable and unstable repos.[^1] 222 223 ```bash 224 echo "@community http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories 225 apk add github-cli@community 226 ``` 227 228 ### Void Linux 229 Void Linux users can install from the [official distribution repo](https://voidlinux.org/packages/?arch=x86_64&q=github-cli): 230 231 ```bash 232 sudo xbps-install github-cli 233 ``` 234 235 [releases page]: https://github.com/ungtb10d/cli/releases/latest 236 [arch linux repo]: https://www.archlinux.org/packages/community/x86_64/github-cli 237 [arch linux aur]: https://aur.archlinux.org/packages/github-cli-git 238 [^1]: https://wiki.alpinelinux.org/wiki/Package_management#Repository_pinning