Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Homebrew: Publish Your First Formula

eddie cianci
August 26, 2015
1.8k

Homebrew: Publish Your First Formula

We walk through creating the simplest homebrew formula, installing a pre-compiled binary.

eddie cianci

August 26, 2015
Tweet

Transcript

  1. PREREQUISITES This exercise installs a pre-compiled binary. It assumes you

    already have and: Homebrew 1. a binary program, 2. in a zip file, 3. downloadable from the web.
  2. 1. CREATE YOUR FORMULA The following command will scaffold the

    creation of a new Homebrew formula, using a zipped archive of the package to be installed: b r e w c r e a t e h t t p s : / / g i t h u b . c o m / d e f e a t e d / t o u c h p / r e l e a s e s / d o w n l o a d / 0 . 0 . 1 / t o u c h p -
  3. c l a s s T o u c h

    p 0 1 1 D a r w i n A m d < F o r m u l a d e s c " " h o m e p a g e " " u r l " h t t p s : / / g i t h u b . c o m / d e f e a t e d / t o u c h p / r e l e a s e s / d o w n l o a d / 0 . 0 . 1 / t o u c h p - 0 . 1 . 1 - d a s h a 2 5 6 " f 0 2 7 5 b 3 4 d 8 7 c 6 2 4 5 4 1 d d 0 4 8 2 4 8 1 5 2 9 0 6 6 6 b c 6 d e 5 0 5 5 6 3 2 d 3 2 d 4 d 1 5 4 5 0 7 e 2 7 e d 0 " d e f i n s t a l l e n d t e s t d o e n d e n d
  4. 2. EDIT YOUR FORMULA To open a formula, run the

    following, then tell Homebrew what steps to perform to install (and test!) your package: b r e w e d i t t o u c h p - 0 . 1 . 1 - d a r w i n - a m d 6 4
  5. c l a s s T o u c h

    p 0 1 1 D a r w i n A m d < F o r m u l a d e s c " l i k e ` m k d i r - p ` c o m b i n e d w i t h ` t o u c h ` , w r i t t e n i n G o . " h o m e p a g e " h t t p s : / / g i t h u b . c o m / d e f e a t e d / t o u c h p " u r l " h t t p s : / / g i t h u b . c o m / d e f e a t e d / t o u c h p / r e l e a s e s / d o w n l o a d / 0 . 0 . 1 / t o u c h p - 0 . 1 . 1 - d a s h a 2 5 6 " f 0 2 7 5 b 3 4 d 8 7 c 6 2 4 5 4 1 d d 0 4 8 2 4 8 1 5 2 9 0 6 6 6 b c 6 d e 5 0 5 5 6 3 2 d 3 2 d 4 d 1 5 4 5 0 7 e 2 7 e d 0 " d e f i n s t a l l # c o p y ` t o u c h p ` ( f r o m t h e a r c h i v e u r l a b o v e ) , t o t h e ` b i n ` d i r e c t o r y b i n . i n s t a l l " t o u c h p " e n d # h t t p s : / / g i t h u b . c o m / H o m e b r e w / h o m e b r e w / b l o b / m a s t e r / s h a r e / d o c / h o m e b r e w / F o r m u l a - C t e s t d o # r u n ` t o u c h p p a t h / t o / f i l e . t x t ` t h e n v e r i f y t h e f i l e e x i s t s i n t h e # s p e c i f i e d p a t h . e x p e c t e d _ f i l e = " p a t h / t o / f i l e . t x t " s y s t e m " # { b i n } / t o u c h p " , e x p e c t e d _ f i l e s y s t e m " s t a t " , e x p e c t e d _ f i l e
  6. 3. INSTALL YOUR PACKAGE To i n s t a

    l l your package with this formula, run: b r e w i n s t a l l t o u c h p - 0 . 1 . 1 - d a r w i n - a m d 6 4 And you can optionally t e s t to ensure it works: b r e w t e s t t o u c h p - 0 . 1 . 1 - d a r w i n - a m d 6 4 When iterating on a formula, use r e i n s t a l l : b r e w r e i n s t a l l t o u c h p - 0 . 1 . 1 - d a r w i n - a m d 6 4
  7. 4. PUBLISH YOUR PACKAGE (UNOFFICIAL) Make your formula available over

    the web, then anyone can install it. Example: b r e w i n s t a l l h t t p s : / / r a w . g i t h u b u s e r c o n t e n t . c o m / d e f e a t e d / t o u c h p / m a s t e r / t o u c h p . r b
  8. 4. PUBLISH YOUR PACKAGE (OFFICIAL) b r e w u

    p d a t e c d $ ( b r e w - - r e p o s i t o r y ) g i t c h e c k o u t - b t o u c h p - 0 . 1 . 1 - d a r w i n - a m d 6 4 g i t a d d L i b r a r y / F o r m u l a / t o u c h p - 0 . 1 . 1 - d a r w i n - a m d 6 4 . r b g i t c o m m i t - m " t o u c h p 0 . 1 . 1 ( n e w f o r m u l a ) " g i t p u s h g i t @ g i t h u b . c o m : Y O U R _ U S E R / h o m e b r e w . g i t t o u c h p - 0 . 1 . 1 - d a r w i n - a m d 6 4 1. fork the homebrew repository on GitHub, 2. create a new branch with your formula, 3. then open a pull request.