Skip to content

Instantly share code, notes, and snippets.

@mlafeldt
Created February 16, 2016 15:48
Show Gist options
  • Star 21 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mlafeldt/8e7d50ee0b1de44e256d to your computer and use it in GitHub Desktop.
Save mlafeldt/8e7d50ee0b1de44e256d to your computer and use it in GitHub Desktop.
Providing a Homebrew tap backed by private GitHub repo

First of all, install Homebrew itself.

As the tap is a private Git repo, you need to generate a GitHub token with repo scope and then add this token to your ~/.netrc file like this:

machine github.com
  login <your GitHub user>
  password <your GitHub token>

Now you can add the tap to your system:

brew tap user/repo

Afterwards, you can finally install tools provided by the tap:

Install the current version of tool XYZ:

brew install XYZ

Install the latest version of tool XYZ:

brew rm XYZ; brew install --HEAD XYZ
@ed9w2in6
Copy link

@KevinGimbel
It works with private repo by using the old removed install strategy from homebrew GitHubPrivateRepositoryReleaseDownloadStrategy.
But to use it like how it is shown by @sgeb, you will need a sub-directory, lets say my_strategies, on the top of your repo's directory.
You should now put the strategy definition inside my_strategies, lets say it is called custom_strategy.rb.
Then, for the rest of your formulas, which should be on the top of your repo's directory, put this on the top:

require_relative 'my_strategies/custom_strategy'
# ... rest  of your formula ... #

I got the idea from: https://gist.github.com/minamijoyo/3d8aa79085369efb79964ba45e24bb0e
I tried and it works perfectly fine. Just remember brew audit will not pass if you use this strategy, as the repo will seem unaccessible to brew.

@alexanderbird
Copy link

One very hacky option: set the url in the formula to file:///tmp/file.tar.gz and let your install instructions be:

curl https://url/to/file.tar.gz > /tmp/file.tar.gz
brew install <owner>/<repo>/<file>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment