Developer Tools41k+ stars

Homebrew

The missing package manager for macOS

Commit Details

Message
"Initial commit"
Author
Max Howell
Date
2009-05-20
Hash
6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a

Fun Fact

Max Howell was famously rejected by Google because he couldn't invert a binary tree on a whiteboard - despite creating Homebrew used by millions.

</>First Code

Ruby
#!/usr/bin/ruby
# Homebrew - The missing package manager for macOS
# (C) 2009 Max Howell

class Formula
  def initialize(name)
    @name = name
  end
  
  def install
    # Override in subclass
    raise NotImplementedError
  end
  
  def brew
    # Download, unpack, configure, make, install
    system "./configure", "--prefix=#{prefix}"
    system "make", "install"
  end
end

# Example formula
class Wget < Formula
  url "https://ftp.gnu.org/wget-1.0.tar.gz"
  
  def install
    brew
  end
end