HOMEBREW
Awesome Package Management for OS X




ATLRUG                                 RailsMachine
June 2010            ...
HOMEBREW

1. Introduction

2. Getting Started

3. Creating Your Own Packages

4. Wrapping Things Up
HOMEBREW

1. Introduction

2. Getting Started

3. Creating Your Own Packages

4. Wrapping Things Up
INTRODUCTION
INTRODUCTION
• Packagemanagement for OS
 X that doesn’t suck
INTRODUCTION
• Packagemanagement for OS
 X that doesn’t suck

• Powered   by Ruby and Git
INTRODUCTION
• Packagemanagement for OS
 X that doesn’t suck

• Powered    by Ruby and Git

• Pretty   popular
INTRODUCTION
• Packagemanagement for OS
 X that doesn’t suck

• Powered    by Ruby and Git

• Pretty   popular

• Easy   t...
INTRODUCTION
• Packagemanagement for OS
 X that doesn’t suck

• Powered    by Ruby and Git

• Pretty   popular

• Easy   t...
HOW POPULAR IS PRETTY POPULAR?
HOW POPULAR IS PRETTY POPULAR?
HOW POPULAR IS PRETTY POPULAR?
WHY USE HOMEBREW?
WHY USE HOMEBREW?
• Fink   and MacPorts have the wrong philosophy
WHY USE HOMEBREW?
• Fink   and MacPorts have the wrong philosophy

• Sticks   to one standard prefix — /usr/local
WHY USE HOMEBREW?
• Fink   and MacPorts have the wrong philosophy

• Sticks   to one standard prefix — /usr/local

• Doesn’...
WHY USE HOMEBREW?
• Fink   and MacPorts have the wrong philosophy

• Sticks   to one standard prefix — /usr/local

• Doesn’...
WHY USE HOMEBREW?
• Fink   and MacPorts have the wrong philosophy

• Sticks   to one standard prefix — /usr/local

• Doesn’...
WHY NOT?
WHY NOT?
• Support for multiple versions of the same package is
 “okay”, but not great
WHY NOT?
• Support for multiple versions of the same package is
 “okay”, but not great

• Fink   and Macports “work” for n...
WHY NOT?
• Support for multiple versions of the same package is
 “okay”, but not great

• Fink   and Macports “work” for n...
HOMEBREW

1. Introduction

2. Getting Started

3. Creating Your Own Packages

4. Wrapping Things Up
GETTING STARTED
GETTING STARTED

# Install Homebrew

$ ruby -e "$(curl http://gist.github.com/raw/323731/install_homebrew.rb)"

# Update f...
USING HOMEBREW
$   brew install foo
$   brew uninstall foo
$   brew search [/regex/] [substring]
#   Update formulas from ...
SOME FORMULAS
ack             haproxy     nginx

bzr             hg          redis

git             hub         rlwrap

ca...
HOMEBREW

1. Introduction

2. Getting Started

3. Creating Your Own Packages

4. Wrapping Things Up
METAPHORS
             The package      /usr/local/Library/
 Formula
              description      Formula/foo.rb

      ...
CODE
require 'formula'
CODE
require 'formula'

class Sl < Formula
  url 'http://ftp.de.debian.org/debian/pool/main/s/sl/
sl_3.03.orig.tar.gz'
  v...
CODE
require 'formula'

class Sl < Formula
  url 'http://ftp.de.debian.org/debian/pool/main/s/sl/
sl_3.03.orig.tar.gz'
  v...
HOMEBREW

1. Introduction

2. Getting Started

3. Creating Your Own Packages

4. Wrapping Things Up
Any Questions?
HOMEBREW
twitter.com/machomebrew

github.com/mxcl/homebrew

irc.freenode.net/#machomebrew

homebrew@librelist.com
WILL FARRINGTON
Chief Intern of Entirely Superfluous Job Titles
will@railsmachine.com
willfarrington.com

MIKE SKALNIK
Head...
Upcoming SlideShare
Loading in...5
×

Homebrew atlrug

627

Published on

Homebrew slides, June 2010, atlrug

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
627
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
5
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide
  • Introduce yourselves!
  • Here&amp;#x2019;s what we&amp;#x2019;ll be covering today

  • Package managers on OS X have historically been... pretty awful. Homebrew kicks it up a notch.

    The whole package manager is written in Ruby and uses git for the &amp;#x201C;repository&amp;#x201D;

    It&amp;#x2019;s insanely popular. Absolutely huge number of people contributing to it, and even more using it and filing bug reports (ie. requests)

    Contribution is as simple as forking the repo on github and then making an issue with a link to your commits

    All you need to install to get up and running is the OS X toolchain &amp;#x2014; ie. XCode
  • Package managers on OS X have historically been... pretty awful. Homebrew kicks it up a notch.

    The whole package manager is written in Ruby and uses git for the &amp;#x201C;repository&amp;#x201D;

    It&amp;#x2019;s insanely popular. Absolutely huge number of people contributing to it, and even more using it and filing bug reports (ie. requests)

    Contribution is as simple as forking the repo on github and then making an issue with a link to your commits

    All you need to install to get up and running is the OS X toolchain &amp;#x2014; ie. XCode
  • Package managers on OS X have historically been... pretty awful. Homebrew kicks it up a notch.

    The whole package manager is written in Ruby and uses git for the &amp;#x201C;repository&amp;#x201D;

    It&amp;#x2019;s insanely popular. Absolutely huge number of people contributing to it, and even more using it and filing bug reports (ie. requests)

    Contribution is as simple as forking the repo on github and then making an issue with a link to your commits

    All you need to install to get up and running is the OS X toolchain &amp;#x2014; ie. XCode
  • Package managers on OS X have historically been... pretty awful. Homebrew kicks it up a notch.

    The whole package manager is written in Ruby and uses git for the &amp;#x201C;repository&amp;#x201D;

    It&amp;#x2019;s insanely popular. Absolutely huge number of people contributing to it, and even more using it and filing bug reports (ie. requests)

    Contribution is as simple as forking the repo on github and then making an issue with a link to your commits

    All you need to install to get up and running is the OS X toolchain &amp;#x2014; ie. XCode
  • Package managers on OS X have historically been... pretty awful. Homebrew kicks it up a notch.

    The whole package manager is written in Ruby and uses git for the &amp;#x201C;repository&amp;#x201D;

    It&amp;#x2019;s insanely popular. Absolutely huge number of people contributing to it, and even more using it and filing bug reports (ie. requests)

    Contribution is as simple as forking the repo on github and then making an issue with a link to your commits

    All you need to install to get up and running is the OS X toolchain &amp;#x2014; ie. XCode
  • It&amp;#x2019;s the third most forked repository on github!
  • It&amp;#x2019;s the third most forked repository on github!
  • Fink and MacPorts try to shove Linux-style package management into OS X. That&amp;#x2019;s the wrong way to do it. There are plenty of good Linux package managers out there, and yeah, technically they *can* be made to work on OS X, but they&amp;#x2019;ll never really fit in. Homebrew was designed *for* OS X, not around it.

    One of homebrew&amp;#x2019;s own philosophies is that the user shouldn&amp;#x2019;t need super-user or sudo access to install packages. Instead, it makes /usr/local accessible to the current user and recommends using it as the homebrew prefix.

    No duplication means doesn&amp;#x2019;t replace ruby, perl, php, etc

    And as already shown, huge user community
  • Fink and MacPorts try to shove Linux-style package management into OS X. That&amp;#x2019;s the wrong way to do it. There are plenty of good Linux package managers out there, and yeah, technically they *can* be made to work on OS X, but they&amp;#x2019;ll never really fit in. Homebrew was designed *for* OS X, not around it.

    One of homebrew&amp;#x2019;s own philosophies is that the user shouldn&amp;#x2019;t need super-user or sudo access to install packages. Instead, it makes /usr/local accessible to the current user and recommends using it as the homebrew prefix.

    No duplication means doesn&amp;#x2019;t replace ruby, perl, php, etc

    And as already shown, huge user community
  • Fink and MacPorts try to shove Linux-style package management into OS X. That&amp;#x2019;s the wrong way to do it. There are plenty of good Linux package managers out there, and yeah, technically they *can* be made to work on OS X, but they&amp;#x2019;ll never really fit in. Homebrew was designed *for* OS X, not around it.

    One of homebrew&amp;#x2019;s own philosophies is that the user shouldn&amp;#x2019;t need super-user or sudo access to install packages. Instead, it makes /usr/local accessible to the current user and recommends using it as the homebrew prefix.

    No duplication means doesn&amp;#x2019;t replace ruby, perl, php, etc

    And as already shown, huge user community
  • Fink and MacPorts try to shove Linux-style package management into OS X. That&amp;#x2019;s the wrong way to do it. There are plenty of good Linux package managers out there, and yeah, technically they *can* be made to work on OS X, but they&amp;#x2019;ll never really fit in. Homebrew was designed *for* OS X, not around it.

    One of homebrew&amp;#x2019;s own philosophies is that the user shouldn&amp;#x2019;t need super-user or sudo access to install packages. Instead, it makes /usr/local accessible to the current user and recommends using it as the homebrew prefix.

    No duplication means doesn&amp;#x2019;t replace ruby, perl, php, etc

    And as already shown, huge user community
  • Fink and MacPorts try to shove Linux-style package management into OS X. That&amp;#x2019;s the wrong way to do it. There are plenty of good Linux package managers out there, and yeah, technically they *can* be made to work on OS X, but they&amp;#x2019;ll never really fit in. Homebrew was designed *for* OS X, not around it.

    One of homebrew&amp;#x2019;s own philosophies is that the user shouldn&amp;#x2019;t need super-user or sudo access to install packages. Instead, it makes /usr/local accessible to the current user and recommends using it as the homebrew prefix.

    No duplication means doesn&amp;#x2019;t replace ruby, perl, php, etc

    And as already shown, huge user community
  • Homebrew can install multiple versions of the same package, but it doesn&amp;#x2019;t all &amp;#x201C;link&amp;#x201D; them into place. Basically homebrew installs each package in its own little prefix in /usr/local, but then symlinks one of them into the &amp;#x201C;standard&amp;#x201D; /usr/local directories, like lib and bin. It&amp;#x2019;s not ideal, but it doesn&amp;#x2019;t prevent you from really using multiple versions of things like libraries.

    Change is hard. Getting others to change is really hard.

    Don&amp;#x2019;t like the way Apple ships PHP? Out of luck.
  • Homebrew can install multiple versions of the same package, but it doesn&amp;#x2019;t all &amp;#x201C;link&amp;#x201D; them into place. Basically homebrew installs each package in its own little prefix in /usr/local, but then symlinks one of them into the &amp;#x201C;standard&amp;#x201D; /usr/local directories, like lib and bin. It&amp;#x2019;s not ideal, but it doesn&amp;#x2019;t prevent you from really using multiple versions of things like libraries.

    Change is hard. Getting others to change is really hard.

    Don&amp;#x2019;t like the way Apple ships PHP? Out of luck.
  • Homebrew can install multiple versions of the same package, but it doesn&amp;#x2019;t all &amp;#x201C;link&amp;#x201D; them into place. Basically homebrew installs each package in its own little prefix in /usr/local, but then symlinks one of them into the &amp;#x201C;standard&amp;#x201D; /usr/local directories, like lib and bin. It&amp;#x2019;s not ideal, but it doesn&amp;#x2019;t prevent you from really using multiple versions of things like libraries.

    Change is hard. Getting others to change is really hard.

    Don&amp;#x2019;t like the way Apple ships PHP? Out of luck.

  • Getting homebrew installed and running is pretty easy.
  • Using it, is also pretty easy
  • Finding useful packages, is also really easy.
  • but above all else, creating your own packages to contribute, is really, really easy
  • Some terminology we&amp;#x2019;ll use here. Formulas are the ruby file describing the package, and the keg is where a particular version of a formula is installed to, and the Cellar holds all of these kegs.

    So let&amp;#x2019;s write a package definition
  • First thing is to require the formula library
  • Then, make some method calls to set metadata for the formula
  • and now tell homebrew how to build and install it
  • Once you&amp;#x2019;ve got your formula made or updated and you&amp;#x2019;ve pushed to your own remote, just file an issue on the source repo on github with a link to your commits and wait! That&amp;#x2019;s it.
  • So, any questions?
  • Here&amp;#x2019;s other places you might want to go for homebrew-related activities
  • And thank you!
  • Homebrew atlrug

    1. 1. HOMEBREW Awesome Package Management for OS X ATLRUG RailsMachine June 2010 Will Farrington & Mike Skalnik
    2. 2. HOMEBREW 1. Introduction 2. Getting Started 3. Creating Your Own Packages 4. Wrapping Things Up
    3. 3. HOMEBREW 1. Introduction 2. Getting Started 3. Creating Your Own Packages 4. Wrapping Things Up
    4. 4. INTRODUCTION
    5. 5. INTRODUCTION • Packagemanagement for OS X that doesn’t suck
    6. 6. INTRODUCTION • Packagemanagement for OS X that doesn’t suck • Powered by Ruby and Git
    7. 7. INTRODUCTION • Packagemanagement for OS X that doesn’t suck • Powered by Ruby and Git • Pretty popular
    8. 8. INTRODUCTION • Packagemanagement for OS X that doesn’t suck • Powered by Ruby and Git • Pretty popular • Easy to contribute
    9. 9. INTRODUCTION • Packagemanagement for OS X that doesn’t suck • Powered by Ruby and Git • Pretty popular • Easy to contribute • Only requires XCode
    10. 10. HOW POPULAR IS PRETTY POPULAR?
    11. 11. HOW POPULAR IS PRETTY POPULAR?
    12. 12. HOW POPULAR IS PRETTY POPULAR?
    13. 13. WHY USE HOMEBREW?
    14. 14. WHY USE HOMEBREW? • Fink and MacPorts have the wrong philosophy
    15. 15. WHY USE HOMEBREW? • Fink and MacPorts have the wrong philosophy • Sticks to one standard prefix — /usr/local
    16. 16. WHY USE HOMEBREW? • Fink and MacPorts have the wrong philosophy • Sticks to one standard prefix — /usr/local • Doesn’t duplicate what Apple already provides
    17. 17. WHY USE HOMEBREW? • Fink and MacPorts have the wrong philosophy • Sticks to one standard prefix — /usr/local • Doesn’t duplicate what Apple already provides • Making new packages is dead simple
    18. 18. WHY USE HOMEBREW? • Fink and MacPorts have the wrong philosophy • Sticks to one standard prefix — /usr/local • Doesn’t duplicate what Apple already provides • Making new packages is dead simple • Very active user community
    19. 19. WHY NOT?
    20. 20. WHY NOT? • Support for multiple versions of the same package is “okay”, but not great
    21. 21. WHY NOT? • Support for multiple versions of the same package is “okay”, but not great • Fink and Macports “work” for now
    22. 22. WHY NOT? • Support for multiple versions of the same package is “okay”, but not great • Fink and Macports “work” for now • Doesn’t duplicate anything Apple already provides
    23. 23. HOMEBREW 1. Introduction 2. Getting Started 3. Creating Your Own Packages 4. Wrapping Things Up
    24. 24. GETTING STARTED
    25. 25. GETTING STARTED # Install Homebrew $ ruby -e "$(curl http://gist.github.com/raw/323731/install_homebrew.rb)" # Update formulas $ brew update # List all available formulas $ brew search | less # ... PROFIT!
    26. 26. USING HOMEBREW $ brew install foo $ brew uninstall foo $ brew search [/regex/] [substring] # Update formulas from git $ brew update # Remove old versions of foo $ brew cleanup foo $ brew info foo # Show which installed formulas are outdated $ brew outdated # Remove all old versions of all formulas $ brew prune
    27. 27. SOME FORMULAS ack haproxy nginx bzr hg redis git hub rlwrap cassandra llvm rtorrent clojure memcached sphinx coffee-script mysql subversion ctags mongodb tex-live go monit tokyo-cabinet
    28. 28. HOMEBREW 1. Introduction 2. Getting Started 3. Creating Your Own Packages 4. Wrapping Things Up
    29. 29. METAPHORS The package /usr/local/Library/ Formula description Formula/foo.rb The installation /usr/local/Cellar/ Keg prefix of a foo/0.1 formula The location Cellar where all kegs are /usr/local/Cellar installed
    30. 30. CODE require 'formula'
    31. 31. CODE require 'formula' class Sl < Formula url 'http://ftp.de.debian.org/debian/pool/main/s/sl/ sl_3.03.orig.tar.gz' version '3.03' homepage 'http://packages.debian.org/source/oldstable/sl' md5 'd0d997b964bb3478f7f4968eee13c698' end
    32. 32. CODE require 'formula' class Sl < Formula url 'http://ftp.de.debian.org/debian/pool/main/s/sl/ sl_3.03.orig.tar.gz' version '3.03' homepage 'http://packages.debian.org/source/oldstable/sl' md5 'd0d997b964bb3478f7f4968eee13c698' def install system 'make' bin.install 'sl' man1.install 'sl.1' end end
    33. 33. HOMEBREW 1. Introduction 2. Getting Started 3. Creating Your Own Packages 4. Wrapping Things Up
    34. 34. Any Questions?
    35. 35. HOMEBREW twitter.com/machomebrew github.com/mxcl/homebrew irc.freenode.net/#machomebrew homebrew@librelist.com
    36. 36. WILL FARRINGTON Chief Intern of Entirely Superfluous Job Titles will@railsmachine.com willfarrington.com MIKE SKALNIK Head Intern — Crockpot-Related R&D, Gardening mike@railsmachine.com mikeskalnik.com
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×