Skip to content

GitHub CLI macOS Setup Guide

This guide walks you through installing the official GitHub Command Line Interface (CLI), without using Homebrew, on macOS. You’ll download the binary directly from GitHub, install it, and authenticate it for use.


✅ Overview

The GitHub CLI (gh) enables you to interact with GitHub from the terminal:

  • Manage pull requests & issues
  • View workflows and runs
  • Create & manage repositories
  • And much more

This guide covers:

  1. Downloading the official release
  2. Installing the binary
  3. Authenticating with GitHub
  4. Verifying installation

1. Download the Official Binary

  1. Open the GitHub CLI Releases page: https://github.com/cli/cli/releases
  2. Download the archive for your architecture:

  3. Apple Silicon (M1/M2/M3): *_macOS_arm64.tar.gz (or .zip)

  4. Intel x86-64: *_macOS_amd64.tar.gz (or .zip)
  5. Extract the downloaded archive.

Example using Terminal:

cd ~/Downloads
tar -xzf gh_*_macOS_arm64.tar.gz

You will now have a folder containing the gh executable.


2. Install the Binary to Your PATH

Move the executable to a directory in your PATH (commonly /usr/local/bin).

cd ~/Downloads/gh_*_macOS_arm64/bin
sudo mv gh /usr/local/bin/
sudo chmod +x /usr/local/bin/gh

If /usr/local/bin is not in your PATH, you may prefer another directory such as /opt/local/bin or ~/bin.


3. Verify Installation

Run:

gh --version

You should see output similar to:

gh version X.Y.Z (Intel/MacOS)

If you receive a “command not found,” ensure that the installation target is in your PATH and restart your terminal.


4. Authenticate With GitHub

Run:

gh auth login

You will be prompted to:

  • Choose GitHub.com or Enterprise
  • Choose an authentication method (browser recommended)

Follow the prompts. Once complete, validate authentication:

gh auth status

Expected response includes a message confirming authentication.


5. Quick Usage Examples

List Your Repositories

gh repo list

Create a Pull Request

gh pr create

Show Help

gh help

6. Updating Manually

Because this installation is not via Homebrew, updates are not automatic. To update:

  1. Visit https://github.com/cli/cli/releases
  2. Download the latest macOS archive
  3. Replace the gh binary following the same installation steps

7. Uninstalling

To remove the tool:

sudo rm /usr/local/bin/gh

Optional: You may remove configuration files:

rm -rf ~/.config/gh

Troubleshooting

Issue Solution
gh: command not found Ensure /usr/local/bin is in your PATH
Incorrect architecture Download the correct archive for Intel vs Apple Silicon
Auth issues Run gh auth logout then gh auth login
Conflicting version installed via Homebrew brew uninstall gh

Check PATH with:

echo $PATH

Next Steps

Start integrating GitHub CLI into your workflow:

  • Explore automation features
  • Manage PRs and issues from Terminal
  • Use gh api to interact directly with GitHub’s REST API

To get more help:

gh help

References


< Backend Development - Django Python Dependency Management

Next: iOS — Overview >