Copilotbeginner

How to Install GitHub Copilot CLI on Mac and Windows

Step-by-step instructions for installing GitHub Copilot CLI on macOS and Windows. Set up this AI coding assistant in your terminal with your existing Copilot subscription.

6 min readUpdated January 2025

Want us to handle this for you?

Get expert help →

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.

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.

Open PowerShell and run:

winget install GitHub.Copilot

For prerelease versions:

winget install GitHub.Copilot.Prerelease

For the most stable experience on Windows, use Copilot CLI within WSL:

  1. Install WSL if you have not already:
wsl --install
  1. Open your WSL terminal (Ubuntu or your preferred distribution)

  2. 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:

  1. Check your PowerShell version:
$PSVersionTable.PSVersion
  1. If below version 6, install the latest PowerShell from Microsoft's GitHub releases

Authentication

After installation, authenticate with your GitHub account:

  1. Start Copilot CLI:
copilot
  1. Use the /login slash command when prompted

  2. Follow the browser authentication flow to connect your GitHub account

Alternative: Personal Access Token

If you prefer token-based authentication:

  1. Generate a fine-grained PAT at github.com/settings/personal-access-tokens/new

  2. Select the Copilot Requests permission

  3. 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:

  1. Start Copilot CLI: copilot
  2. Use the /model command
  3. 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:

  1. Close and reopen your terminal
  2. Check if the installation directory is in your PATH
  3. Try reinstalling with a different method

Authentication Issues

If you cannot authenticate:

  1. Verify your Copilot subscription is active at github.com/settings/copilot
  2. Check if your organization has enabled CLI access (Business/Enterprise users)
  3. Try using a Personal Access Token instead

PowerShell Version Issues (Windows)

If you see errors about PowerShell version:

  1. Install PowerShell 7+ from github.com/PowerShell/PowerShell
  2. Or switch to using WSL for better compatibility

Next Steps

Frequently Asked Questions

Find answers to common questions

No, Copilot CLI is included with your existing GitHub Copilot subscription (Individual, Business, or Enterprise). No separate billing or API keys are required.

Need Professional IT & Security Help?

Our team of experts is ready to help protect and optimize your technology infrastructure.