Setting Github API token for Homebrew

keypulsations picture keypulsations · Nov 21, 2013 · Viewed 30.6k times · Source

You need to set HOMEBREW_GITHUB_API_TOKEN for homebrew to avoid rate limiting, but how do you add it to homebrew config?

Answer

reto picture reto · Nov 21, 2013

You create your API token on https://github.com/settings/tokens and then set the environment variable HOMEBREW_GITHUB_API_TOKEN to the value of your token.

When creating the token, make sure that you only select the scopes you need. As pointed out in the answer by Chad, deselecting all of the scopes is very reasonable!

Setting the token is done using the export command. Example:

export HOMEBREW_GITHUB_API_TOKEN=xxxx

To make sure this is set whenever you open a terminal you can add this command to your ~/.bash_profile file.

For future reference, this topic was discussed in the following two issues: