Setting up a new computer with Homebrew
Setting up a new computer can be a lot of work, but I've made it much simpler with Homebrew, a popular package manager.
Creating a list of installed software
As a general rule, I prefer to install all software on my Mac using Homebrew. I always try Homebrew first and only resort to downloading software directly from websites if it is not available through Homebrew.
Homebrew manages both formulae and casks. Casks are typically GUI applications, while formulae are command-line tools or libraries.
First, I generate a list of all manually installed packages on my old computer:
$ brew leaves
The brew leaves
command displays only the packages you installed directly using Homebrew. It excludes any packages that were installed automatically as dependencies. To view all installed packages, including dependencies, you can use the brew list
command.
To save this list to a file:
$ brew leaves > brews.txt
Next, I include installed casks in the same list:
$ brew list --cask >> brews.txt
This appends the cask list to brews.txt
, giving me a complete list of all the packages I've explicitly installed.
Reviewing your packages
It is a good idea to check if you still need all packages on your new computer. I review my packages as follows:
$ cat brews.txt | xargs brew desc --eval-all
This command provides a short description for each package in your list.
Installing your packages on a new machine
Transfer your brews.txt
file to the new computer, install Homebrew, and run:
$ xargs brew install < brews.txt
This installs all the packages listed in your file.