Skip to content

Instantly share code, notes, and snippets.

@deecewan
Created March 14, 2017 08:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deecewan/51cd2a2d40b454f1e43c461ad020458f to your computer and use it in GitHub Desktop.
Save deecewan/51cd2a2d40b454f1e43c461ad020458f to your computer and use it in GitHub Desktop.
Store all your brew formula and reload in case of emergency
# ...
brw() {
brew $@
brew list --versions | perl -pe 's/([\w-(@\d\.\d)]+).*/$1/' > $CONFIG/brew_installed.txt
}
restore_from_brew() {
cat $CONFIG/brew_installed.txt | xargs brew install
}
# Sets up computer
# have other things in here to load back in all your .*rc files
# here is an example using GNU Stow
pushd ~
git clone https://github.com/deecewan/dotfiles.git
pushd dotfiles
find . -type d -maxdepth 1 | xargs stow
# contents of dotfiles is [brew_installed.txt, git, iterm, setup.sh, zsh]
# see `man stow` for more info
# install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
source ~/.zshrc
restore_from_brew
echo "Installed everything"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment