GitHub Copilot CLI brings the power of Copilot's coding agent directly to your terminal. It can help with code generation, debugging, git workflows, and shell commands - all through natural language.
Prerequisites
Before installing Copilot CLI, ensure you have:
- An active GitHub Copilot subscription (Individual, Business, or Enterprise)
- PowerShell v6 or higher (Windows only - see note below)
- Organization approval (if using Business/Enterprise, verify your admin has not disabled CLI access)
Windows Note: Windows 11 ships with PowerShell 5.1 by default. You will need to manually install PowerShell 6 or later, or use WSL for the best experience.
Installing on macOS
macOS users have three installation options.
Option 1: Homebrew (Recommended)
The easiest method for macOS users:
brew install copilot-cli
For prerelease/beta features:
brew install copilot-cli@prerelease
To update later:
brew upgrade copilot-cli
Option 2: Install Script
Quick installation with a single command:
curl -fsSL https://gh.io/copilot-install | bash
Option 3: npm
If you prefer npm:
npm install -g @github/copilot
For prerelease versions:
npm install -g @github/copilot@prerelease
Installing on Windows
Windows users have multiple options, with WSL being recommended for the best experience.
Option 1: WinGet (Recommended for Native Windows)
Open PowerShell and run:
winget install GitHub.Copilot
For prerelease versions:
winget install GitHub.Copilot.Prerelease
Option 2: WSL (Recommended for Best Experience)
For the most stable experience on Windows, use Copilot CLI within WSL:
- Install WSL if you have not already:
wsl --install
-
Open your WSL terminal (Ubuntu or your preferred distribution)
-
Install using the install script:
curl -fsSL https://gh.io/copilot-install | bash
Or use Homebrew in WSL:
brew install copilot-cli
Option 3: npm on Windows
If you have Node.js installed:
npm install -g @github/copilot
Windows PowerShell Requirements
Native Windows PowerShell support is experimental. If you choose native Windows over WSL:
- Check your PowerShell version:
$PSVersionTable.PSVersion
- If below version 6, install the latest PowerShell from Microsoft's GitHub releases
Authentication
After installation, authenticate with your GitHub account:
- Start Copilot CLI:
copilot
-
Use the
/loginslash command when prompted -
Follow the browser authentication flow to connect your GitHub account
Alternative: Personal Access Token
If you prefer token-based authentication:
-
Generate a fine-grained PAT at github.com/settings/personal-access-tokens/new
-
Select the Copilot Requests permission
-
Set the environment variable:
macOS/Linux/WSL:
export GH_TOKEN="your-token-here"
Windows (PowerShell):
$env:GH_TOKEN="your-token-here"
Verify Installation
After authentication, verify everything is working:
copilot --version
Then try a simple command:
copilot "explain what files are in this directory"
Basic Usage
Once installed, navigate to any code directory and run:
copilot
Common tasks:
# Ask questions about your code
copilot "how does the authentication work in this project?"
# Generate code
copilot "write a function to parse CSV files"
# Get help with git
copilot "create a commit message for my staged changes"
# Change AI model
/model # Shows available models
Changing Models
The default model is Claude Sonnet 4.5. To change models:
- Start Copilot CLI:
copilot - Use the
/modelcommand - Select from available options (GPT-5 mini, GPT-4.1, etc.)
Models included with your Copilot subscription do not consume premium requests on paid plans.
Updating Copilot CLI
Keep your installation up to date:
Homebrew:
brew upgrade copilot-cli
WinGet:
winget upgrade GitHub.Copilot
npm:
npm install -g @github/copilot@latest
Troubleshooting
"command not found: copilot"
If the command is not found after installation:
- Close and reopen your terminal
- Check if the installation directory is in your PATH
- Try reinstalling with a different method
Authentication Issues
If you cannot authenticate:
- Verify your Copilot subscription is active at github.com/settings/copilot
- Check if your organization has enabled CLI access (Business/Enterprise users)
- Try using a Personal Access Token instead
PowerShell Version Issues (Windows)
If you see errors about PowerShell version:
- Install PowerShell 7+ from github.com/PowerShell/PowerShell
- Or switch to using WSL for better compatibility
Next Steps
- Read the official Copilot CLI documentation
- Explore Copilot CLI features
- Install Claude Code CLI for another powerful coding assistant
- Learn how to orchestrate multiple AI tools using Claude as an Engineering Manager