Skip to content

Instantly share code, notes, and snippets.

@ptsurko
Last active March 22, 2016 06:49
Show Gist options
  • Save ptsurko/ee16e42b2092d51f533b to your computer and use it in GitHub Desktop.
Save ptsurko/ee16e42b2092d51f533b to your computer and use it in GitHub Desktop.
Create homebrew formula

Create homebrew formula

Create formula file for installation package

brew create https://github.com/bazelbuild/bazel/archive/0.2.0.tar.gz --no-fetch

This will create formula file in /usr/local/Library/Formula/<formula_name>.rb

Update formula file with installation instructions

class Bazel020 < Formula
  desc "Build software of any size, quickly and reliably, just as engineers do at Google."
  homepage "http://bazel.io"
  url "https://github.com/bazelbuild/bazel/archive/0.2.0.tar.gz"
  version "0.2.0"
  sha256 "3685ce039e44224260a7ed5b80dd951155998a6e128b2bebe984ea1d85a674b3"

  depends_on :java => "1.8+"
  depends_on :macos => :yosemite

  def install
    system "./compile.sh"

    bin.install Dir["output/*"] # copies output files from 'output' to brew binary directory
  end

  test do
    system "bazel", "version"
  end
end

To install new formula: brew install bazel-0.2.0

To test formula: brew test bazel-0.2.0

Used resources

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