Installing homebrew

$ ruby -e "$(curl -fsSL"

Updating homebrew

$ brew update

Upgrading homebrew

$ brew upgrade

Upgrading cask

Below will not update casks that do not have versioning information (version :latest) or applications that have a built-in upgrade mechanism (auto_updates true). Run the upgrade command with the --greedy flag

$ brew cask upgrade
$ brew cask upgrade --greedy

Reinstall outdated casks

$ brew cask outdated | xargs brew cask reinstall


$ brew doctor

Installing mongodb formula

$ brew install mongodb

To start mongodb formula

$ brew services start mongodb

To stop mongodb formula

$ brew services stop mongodb

To restart restart formula

$ brew services restart mongodb

Saving installed brew and cask formula list

$ brew list >> brew.txt
$ brew cask list >> brewcask.txt

brew.txt brewcask.txt

Restore brew and cask formula list from a backup file

$ brew install $(< packages.txt )
$ brew install $(cat packages.txt)
$ cat packages.txt | xargs brew install