{"meta":{"title":"Installing GitHub Copilot CLI","intro":"Learn how to install Copilot CLI so that you can use Copilot directly from the command line.","product":"GitHub Copilot","breadcrumbs":[{"href":"/en/copilot","title":"GitHub Copilot"},{"href":"/en/copilot/how-tos","title":"How-tos"},{"href":"/en/copilot/how-tos/copilot-cli","title":"Copilot CLI"},{"href":"/en/copilot/how-tos/copilot-cli/set-up-copilot-cli","title":"Set up Copilot CLI"},{"href":"/en/copilot/how-tos/copilot-cli/set-up-copilot-cli/install-copilot-cli","title":"Install Copilot CLI"}],"documentType":"article"},"body":"# Installing GitHub Copilot CLI\n\nLearn how to install Copilot CLI so that you can use Copilot directly from the command line.\n\nTo find out about Copilot CLI before you install it, see [About GitHub Copilot CLI](/en/copilot/concepts/agents/about-copilot-cli).\n\n## Prerequisites\n\n* **An active GitHub Copilot subscription**. See [Copilot plans](https://github.com/features/copilot/plans?ref_product=copilot\\&ref_type=engagement\\&ref_style=text).\n* (On Windows) **PowerShell** v6 or higher\n\nIf you have access to GitHub Copilot via your organization or enterprise, you cannot use Copilot CLI if your organization owner or enterprise administrator has disabled it in the organization or enterprise settings. See [Managing policies and features for GitHub Copilot in your organization](/en/copilot/managing-copilot/managing-github-copilot-in-your-organization/managing-github-copilot-features-in-your-organization/managing-policies-for-copilot-in-your-organization).\n\n## Installing or updating Copilot CLI\n\nYou can install Copilot CLI using WinGet (Windows), Homebrew (macOS and Linux), npm (all platforms), or an install script (macOS and Linux).\n\n### Installing with npm (all platforms)\n\nPrerequisite: Node.js 22 or later.\n\n```shell copy\nnpm install -g @github/copilot\n```\n\n> \\[!NOTE]\n> If you have `ignore-scripts=true` in your `~/.npmrc` file, you must use the command:\n>\n> ```shell copy\n> npm_config_ignore_scripts=false npm install -g @github/copilot\n> ```\n\nTo install the prerelease version:\n\n```shell copy\nnpm install -g @github/copilot@prerelease\n```\n\n### Installing with WinGet (Windows)\n\n```powershell copy\nwinget install GitHub.Copilot\n```\n\nTo install the prerelease version:\n\n```powershell copy\nwinget install GitHub.Copilot.Prerelease\n```\n\n### Installing with Homebrew (macOS and Linux)\n\n```shell copy\nbrew install copilot-cli\n```\n\nTo install the prerelease version:\n\n```shell copy\nbrew install copilot-cli@prerelease\n```\n\n### Installing with the install script (macOS and Linux)\n\n```shell copy\ncurl -fsSL https://gh.io/copilot-install | bash\n```\n\nOr:\n\n```shell copy\nwget -qO- https://gh.io/copilot-install | bash\n```\n\nTo run as root and install to `/usr/local/bin`, use `| sudo bash`.\n\nTo install to a custom directory, set the `PREFIX` environment variable. It defaults to `/usr/local` when run as root or `$HOME/.local` when run as a non-root user.\n\nTo install a specific version, set the `VERSION` environment variable. It defaults to the latest version.\n\nFor example, to install version `v0.0.369` to a custom directory:\n\n```shell copy\ncurl -fsSL https://gh.io/copilot-install | VERSION=\"v0.0.369\" PREFIX=\"$HOME/custom\" bash\n```\n\n### Download from GitHub.com\n\nYou can download the executables directly from [the `copilot-cli` repository](https://github.com/github/copilot-cli/releases/).\n\nDownload the executable for your platform, unpack it, and run.\n\n## Authenticating with Copilot CLI\n\nOn first launch, if you're not currently logged in to GitHub, you'll be prompted to use the `/login` slash command. Enter this command and follow the on-screen instructions to authenticate. For more information on the authentication process, see [Authenticating GitHub Copilot CLI](/en/copilot/how-tos/copilot-cli/set-up-copilot-cli/authenticate-copilot-cli).\n\n### Authenticating with a personal access token\n\nYou can also authenticate using a fine-grained personal access token with the \"Copilot Requests\" permission enabled.\n\n1. Visit [Fine-grained personal access tokens](https://github.com/settings/personal-access-tokens/new).\n2. Under \"Permissions,\" click **Add permissions** and select **Copilot Requests**.\n3. Click **Generate token**.\n4. Export the token in your terminal or environment configuration. Use the `COPILOT_GITHUB_TOKEN`, `GH_TOKEN`, or `GITHUB_TOKEN` environment variable (in order of precedence).\n\n## Next steps\n\nYou can now use Copilot from the command line. See [Using GitHub Copilot CLI](/en/copilot/how-tos/use-copilot-agents/use-copilot-cli)."}