GitHub provides a convenient command-line interface called gh
that allows you to interact with GitHub repositories directly from your terminal. This article will guide you through the process of installing the GitHub CLI on both Windows and Mac operating systems.
Requirements
Ensure that you have the following installed on your system:
Git: GitHub CLI requires Git (version 2.28 or higher).
Operating System: Windows 7 or later, macOS X Mojave or later.
Installing on Windows
Step 1: Download the GitHub CLI
To start, navigate to the GitHub CLI releases page at https://github.com/cli/cli/releases/latest. Here, you will find the latest release of GitHub CLI. Download the MSI file appropriate for your system (32-bit or 64-bit).
Step 2: Run the Installer
Once the MSI file has been downloaded, locate it on your system and double-click to run the installer.
Step 3: Follow the Installation Wizard
The installation wizard will guide you through the installation process. You can leave all settings at their defaults and click "Next" to proceed through the prompts.
Step 4: Complete the Installation
Once the installation is complete, click on the "Finish" button. You will now be able to use GitHub CLI from your terminal.
Installing on macOS
Step 1: Open Terminal
Navigate to your Applications folder, then Utilities, and open Terminal.
Step 2: Install Homebrew (if not installed)
Homebrew is a package manager for macOS that makes it easy to install a variety of software. If you don't have it installed already, you can install it by pasting the following command into your terminal and pressing Enter
:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Step 3: Install GitHub CLI
Once you have Homebrew installed, you can install GitHub CLI by entering the following command into your terminal:
brew install gh
After running this command, Homebrew will automatically download and install the GitHub CLI.
Verifying the Installation
For both Windows and macOS, you can verify that GitHub CLI has been correctly installed by opening a new terminal window and typing the following command:
gh --version
If the installation was successful, you should see the version of GitHub CLI that you installed displayed in the terminal.
Conclusion
Now that you have GitHub CLI installed on your system, you can begin to use it to manage your repositories, create pull requests, and perform many other tasks directly from your terminal, without having to navigate to the GitHub website. For a full list of commands and features, be sure to check out the official GitHub CLI manual at https://cli.github.com/manual/.