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:
- Downloading the official release
- Installing the binary
- Authenticating with GitHub
- Verifying installation
1. Download the Official Binary¶
- Open the GitHub CLI Releases page: https://github.com/cli/cli/releases
-
Download the archive for your architecture:
-
Apple Silicon (M1/M2/M3):
*_macOS_arm64.tar.gz(or.zip) - Intel x86-64:
*_macOS_amd64.tar.gz(or.zip) - 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/binis not in yourPATH, you may prefer another directory such as/opt/local/binor~/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:
- Visit https://github.com/cli/cli/releases
- Download the latest macOS archive
- Replace the
ghbinary 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 apito interact directly with GitHub’s REST API
To get more help:
gh help
References¶
- GitHub CLI: https://cli.github.com/
- Source Repo: https://github.com/cli/cli
< Backend Development - Django Python Dependency Management
Next: iOS — Overview >