Last active
December 21, 2017 09:23
-
-
Save hyukhur/eb8be838cc506994bf5c1c9a0ff11f97 to your computer and use it in GitHub Desktop.
backup Homebrew packages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bash backup-homebrew.sh >restore-homebrew.sh && chmod +x restore-homebrew.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
brew_command=/usr/local/bin/brew | |
brew_cask_command="$brew_command cask" | |
echo '#!/bin/bash' | |
echo '' | |
echo 'trap ctrl_c INT' | |
echo 'function ctrl_c() {' | |
echo 'echo "** Trapped CTRL-C"' | |
echo 'exit 1' | |
echo '}' | |
echo '' | |
echo 'brew_command=/usr/local/bin/brew' | |
echo 'brew_cask_command="$brew_command cask"' | |
echo 'failed_items=""' | |
echo 'function install_package() {' | |
echo 'echo EXECUTING: brew install $1 $2' | |
echo '$brew_command install $1 $2' | |
echo '[ $? -ne 0 ] && $failed_items="$failed_items $1" # package failed to install.' | |
echo '}' | |
echo 'function install_cask_package() {' | |
echo 'echo EXECUTING: brew cask install $1' | |
echo '$brew_cask_command install $1' | |
echo '[ $? -ne 0 ] && $failed_items="$failed_items $1" # package failed to install.' | |
echo '}' | |
$brew_command tap | while read tap; do echo "$brew_command tap $tap"; done | |
$brew_command list | while read item; | |
do | |
echo "install_package $item '$($brew_command info $item | /usr/bin/grep 'Built from source with:' | /usr/bin/sed 's/^[ \t]*Built from source with:/ /g; s/\,/ /g')'" | |
done | |
$brew_cask_command list | while read item; | |
do | |
echo "install_cask_package $item" | |
done | |
echo '[ ! -z $failed_items ] && echo The following items were failed to install: && echo $failed_items' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
trap ctrl_c INT | |
function ctrl_c() { | |
echo "** Trapped CTRL-C" | |
exit 1 | |
} | |
brew_command=/usr/local/bin/brew | |
brew_cask_command="$brew_command cask" | |
failed_items="" | |
function install_package() { | |
echo EXECUTING: brew install $1 $2 | |
$brew_command install $1 $2 | |
[ $? -ne 0 ] && $failed_items="$failed_items $1" # package failed to install. | |
} | |
function install_cask_package() { | |
echo EXECUTING: brew cask install $1 | |
$brew_cask_command install $1 | |
[ $? -ne 0 ] && $failed_items="$failed_items $1" # package failed to install. | |
} | |
/usr/local/bin/brew tap blender/tap | |
/usr/local/bin/brew tap caskroom/cask | |
/usr/local/bin/brew tap caskroom/fonts | |
/usr/local/bin/brew tap homebrew/bundle | |
/usr/local/bin/brew tap homebrew/completions | |
/usr/local/bin/brew tap homebrew/core | |
/usr/local/bin/brew tap homebrew/dupes | |
/usr/local/bin/brew tap homebrew/services | |
/usr/local/bin/brew tap homebrew/versions | |
install_package autoconf '' | |
install_package bash-completion '' | |
install_package bundler-completion '' | |
#install_package cairo '' | |
install_package carthage '' | |
install_package chisel '' | |
#install_package fontconfig '' | |
#install_package freetype '' | |
#install_package gd '' | |
#install_package gdbm '' | |
install_package gem-completion '' | |
#install_package gettext '' | |
install_package git '' | |
install_package git-hooks '' | |
install_package glib '' | |
#install_package gobject-introspection '' | |
#install_package graphviz '' | |
#install_package jpeg '' | |
#install_package jq '' | |
#install_package libffi '' | |
#install_package libgcrypt '' | |
#install_package libgpg-error '' | |
#install_package libpng '' | |
#install_package libtiff '' | |
#install_package libtool '' | |
#install_package little-cms2 '' | |
install_package mas '' | |
#install_package mogenerator '' | |
#install_package oniguruma '' | |
#install_package openjpeg '' | |
#install_package openssl '' | |
#install_package [email protected] '' | |
#install_package pcre '' | |
#install_package pdfgrep '' | |
#install_package pixman '' | |
#install_package pkg-config '' | |
#install_package pngquant '' | |
#install_package poppler '' | |
#install_package python '' | |
install_package rbenv '' | |
#install_package readline '' | |
install_package rmtrash '' | |
#install_package rome '' | |
#install_package ruby-build '' | |
#install_package s3cmd '' | |
install_package shellcheck '' | |
#install_package sqlite '' | |
install_package swiftplate '' | |
#install_package webp '' | |
install_package wget '' | |
#install_package xcproj '' | |
#install_package zopfli '' | |
install_cask_package android-file-transfer | |
install_cask_package android-studio | |
install_cask_package asset-catalog-tinkerer | |
install_cask_package beardedspice | |
#install_cask_package clipmenu | |
install_cask_package clipy | |
#install_cask_package docker | |
install_cask_package emacs | |
install_cask_package fastlane | |
#install_cask_package font-source-code-pro | |
install_cask_package free-ruler | |
install_cask_package google-chrome | |
#install_cask_package gureumkim | |
#install_cask_package hipchat | |
#install_cask_package kaleidoscope | |
#install_cask_package kitematic | |
#install_cask_package knuff | |
install_cask_package macdown | |
install_cask_package magican | |
#install_cask_package meld | |
#install_cask_package near-lock | |
install_cask_package opensim | |
install_cask_package p4merge | |
install_cask_package pophub | |
install_cask_package qlplayground | |
install_cask_package quicklook-csv | |
install_cask_package quickradar | |
#install_cask_package rocket | |
install_cask_package sourcetree | |
install_cask_package supaview | |
install_cask_package synergy | |
install_cask_package visual-studio-code | |
install_cask_package wwdc | |
install_cask_package zeplin | |
#install_package autoconf '' | |
#install_package bash-completion '' | |
#install_package bundler-completion '' | |
#install_package cairo '' | |
install_package carthage '' | |
install_package chisel '' | |
#install_package emacs '' | |
#install_package fontconfig '' | |
#install_package freetype '' | |
#install_package gdk-pixbuf '' | |
install_package gem-completion '' | |
#install_package gettext '' | |
install_package git '' | |
#install_package glib '' | |
#install_package gobject-introspection '' | |
#install_package harfbuzz '' | |
#install_package icu4c '' | |
#install_package jpeg '' | |
#install_package jq '' | |
#install_package libcroco '' | |
#install_package libffi '' | |
#install_package libpng '' | |
#install_package librsvg '' | |
#install_package libtiff '' | |
#install_package mas '' | |
#install_package mogenerator '' | |
#install_package oniguruma '' | |
#install_package openssl '' | |
#install_package pango '' | |
#install_package pcre '' | |
#install_package pixman '' | |
#install_package pkg-config '' | |
#install_package pngquant '' | |
install_package rbenv '' | |
install_package rmtrash '' | |
#install_package ruby-build '' | |
#install_package shared-mime-info '' | |
install_package swiftgen '' | |
#install_package watch '' | |
install_package wget '' | |
#install_package xcproj '' | |
#install_package zopfli '' | |
install_cask_package android-file-transfer | |
#install_cask_package balsamiq-mockups | |
#install_cask_package clipmenu | |
#install_cask_package coconutbattery | |
install_cask_package emacs | |
#install_cask_package fauxpas | |
install_cask_package free-ruler | |
#install_cask_package gitup | |
install_cask_package google-chrome | |
#install_cask_package google-hangouts | |
#install_cask_package hipchat | |
#install_cask_package hirundo | |
#install_cask_package hopper-disassembler | |
#install_cask_package iexplorer | |
install_cask_package macdown | |
install_cask_package magican | |
install_cask_package pophub | |
install_cask_package qlplayground | |
install_cask_package quicklook-csv | |
install_cask_package quickradar | |
#install_cask_package ridibooks | |
#install_cask_package skype | |
install_cask_package supaview | |
[ ! -z $failed_items ] && echo The following items were failed to install: && echo $failed_items |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment