Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add command to export homebrew installed formulas

This culls the dependent packages from the installed list, leaving only
the top-level installs.
  • Loading branch information...
commit c2e10f9d66ee7d5d5d1e18a7582df754f9fc84e3 1 parent c01bd71
@jwhitley authored
Showing with 22 additions and 0 deletions.
  1. +22 −0 local/mac/bin/brew-export
View
22 local/mac/bin/brew-export
@@ -0,0 +1,22 @@
+#!/bin/zsh
+
+set -e
+
+tmpdir=`mktemp -d "$HOME/tmp/${0:t}.XXXXXXXXXXX"`
+deps=$tmpdir/brew.deps
+formulas=$tmpdir/brew.formulas
+dependents=$tmpdir/brew.dependents
+install_set=$tmpdir/brew.install_set
+
+brew deps -n --installed > $deps
+
+# Extract the list of formulas
+brew list > $formulas
+
+# Extract the dependents
+cut -d: -f 2 $deps | sed -e 's/^ //' -e '/^$/d' -e 's/ /\
+/g' | sort -u > $dependents
+
+cat $formulas $dependents | sort | uniq -u
+
+rm -rf $tmpdir
Please sign in to comment.
Something went wrong with that request. Please try again.