The Problem
Every once in a while, we nee change our workstation and reinstall all softwares. We don’t want to to website, download binary, click it to install for all these tools.
We can use HomeBrew to install them in command line, and even better have one script to install all tools.
Install HomeBrew
/usr/bin/ruby -e "$(curl -fsSL \
https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew search
brew search iterm2
brew list
: List all installed formulae.brew update
: Fetch the newest version of Homebrew and all formulaebrew upgrade
: Upgrade outdated, unpinned formulaebrew upgrade <formula>
to update a package
brew cleanup
: remove old versions of installed formulaebrew uninstall the_name
brew outdated
: Show formulae that have an updated version available.brew doctor
: Check your system for potential problems.
brew tap
- The default formulae: homebrew-core
- brew tap adds more repositories to the list of formulae that brew tracks, updates, and installs from.
brew tap
: list tapped repositoriesbrew tap <tapname>
: add tapbrew untap <tapname>
: remove a tap
Homebrew Cask
- Cask allows us to install large binary files via a command-line tool.
- Install cask by adding it as a tap:
brew tap caskroom/cask
brew cask list
: with no args, lists installed Casks; given installed Casks, lists staged files
Homebrew Cask Versions
- Another git repo from homebrew that allows us to install beta or older versions.
- Install:
brew tap homebrew/cask-versions
- Example:
brew cask install atom-beta
brew cask uninstall atom-deta
brew cask info atom-beta
Bash Completion
brew install bash-completion
- Add bash-completion to your ~/.bash_profile:
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion || {
# if not found in /usr/local/etc, try the brew --prefix location
[ -f "$(brew --prefix)/etc/bash_completion.d/git-completion.bash" ] && \
. $(brew --prefix)/etc/bash_completion.d/git-completion.bash
}
Oracle Java vs OpenJDK
Install Oracle Java
- Install latest Oracle Java:
brew cask install java
- Install older Oracle Java from cask-versions:
brew cask install java8
- Run
brew tap caskroom/versions
if not added cask-versions before.
- Run
Install OpenJDK
#### One Script to Install All
brew update
brew upgrade --all
brew install git
# change default applications
brew install duti
brew install pandoc
brew install htop
brew install wget
brew install watch
# https://github.com/AdoptOpenJDK/homebrew-openjdk
# brew cask install adoptopenjdk
# adoptopenjdk11, adoptopenjdk11-jre
brew tap AdoptOpenJDK/openjdk
brew cask install adoptopenjdk11
brew tap caskroom/cask
brew tap homebrew/cask-versions
# or iterm2-beta
brew cask install iterm2
brew cask install google-chrome
brew cask install google-chrome-canary
brew cask install visual-studio-code
brew cask install visual-studio-code-insiders
brew cask install intellij-idea
brew cask install eclipse-jee
brew cask install docker
brew cask install postman
# Tools
brew cask install the-unarchiver
# MPV media player
brew install mpv
# vlc media player
brew cask install vlc
brew cask install slack
# Java development
brew install maven
brew install gradle
# toggle dark-mode in command line
brew install dark-mode
brew cask install flux
# convert and resize images
brew install imagemagick
brew cleanup
brew cask cleanup