Skip to content

Instantly share code, notes, and snippets.

@czj
Created January 29, 2018 08:50
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 czj/c460f339c269c3945cc10f018a752d62 to your computer and use it in GitHub Desktop.
Save czj/c460f339c269c3945cc10f018a752d62 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
if `brew --version`.include? 'Homebrew'
puts "Homebrew already installed."
else
puts "Installing Homebrew ..."
`/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"`
end
`brew upgrade`
formulas = %w[
ctags
diff-so-fancy
exa
ffmpeg
fish
fzf
git
graphicsmagick
heroku
hub
jemalloc
jpegoptim
libffi
libyaml
memcached
node
openssl
optipng
phantomjs
pngquant
postgresql
rbenv
rbenv-default-gems
readline
redis
ripgrep
rsync
the_silver_searcher
wdiff
xz
yarn
youtube-dl
]
installed_formulas = `brew list -1`.split("\n")
already_installed_formulas = installed_formulas & formulas
unless already_installed_formulas.empty?
puts "Already installed formulas : #{already_installed_formulas.join(', ')}"
end
not_installed_formulas = formulas - installed_formulas
unless not_installed_formulas.empty?
puts "Installing formulas : #{not_installed_formulas.join(', ')}"
`brew install #{not_installed_formulas.join(' ')}`
end
# Mac App Store : cloudapp keka
casks = %w[
atom
caret
colorpicker-propicker
colorpicker-skalacolor
google-chrome
hetimazipql
imagealpha
imageoptim
istat-menus
iterm2
libreoffice
licecap
mumble
nvalt
onyx
postico
postman
ql-ansilove
qlcolorcode
qlmarkdown
qlmobi
qlprettypatch
qlstephen
qlswift
quickgeojson
quicklook-csv
quicklook-json
quitter
sublime-text
suspicious-package
transmission
vlc
webpquicklook
xld
]
unless `brew tap`.include?("caskroom/cask")
`brew tap caskroom/cask`
end
installed_casks = `brew cask list -1`.split("\n")
already_installed_casks = installed_casks & casks
unless already_installed_casks.empty?
puts "Already installed casks : #{already_installed_casks.join(', ')}"
end
not_installed_casks = casks - installed_casks
unless not_installed_casks.empty?
puts "Installing casks : #{not_installed_casks.join(', ')}"
`brew cask install #{not_installed_casks.join(' ')}`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment