Huge thanks to unilock for helping me test and add functionality to the script!
- This script is primarily targeted to be used on macOS, but it should also work on Linux if you remove parts of the script referencing
brew cask
andmas
. - You do not need to run this script with the sudo, the script will automatically prompt you for your password every time you run it. This prevents you being asked for your password every time Homebrew installs a cask that needs to be symlinked into your Applications folder.
- Please see the "Troubleshooting" section below to serve as answers/solutions for frequent questions and issues.
- Download the script here and extract the zip archive.
- Open Terminal, and
cd
to the extracted folder. - Run
nano ./packages.txt
to see and edit the list of applications the script will install. The script provides some default taps and packages to install, but these are entirely optional. I reccomend keeping mackup to enable the backing up of application and system preferences and mas to enable the installation of Mac App Store apps via the script. - Once you have you have modified
packages.txt
to your liking, run script using./brew.sh
. I reccomend doing this in a virtual machine first in case any issues arise, but this is optional as well. Please note that the script expects being ran on a clean install of macOS or Linux, so if an existing Homebrew installation is detected, the script will simply update your existing packages, ignoring your packages.txt file. To get around this, you have a few options:- Perform a clean installation of macOS. This option ensures that you won't face any issues with conflicting Homebrew packages or leftover files. However, this comes with the obvious disadvantage that you have to backup your data, log back in to everything, and re-license any paid software you may have. This is the ideal method, but it understandably isn't practical for most users.
- Uninstall Homebrew. You can find the commands you'll need to do this here. Please note that this will remove all Homebrew software, including taps, packages, and casks. Make a backup before proceeding as this can be a destructive operation depending on how many applications you've installed with Homebrew.
- Modify the script to remove the parts checking for an existing Homebrew installation. I'm not going to write out how to do this because, frankly, if you don't know how to remove a loop from a bash script, you probably shouldn't be using this method to begin with. Use one of the other two solutions listed above instead.
- Once the script executes, you will be prompted for your administrator password. Enter it, and when you are prompted to, press enter to confirm the installation of Xcode's command line tools. Now, relax and go grab a coffee!
- Open Terminal and
cd
to the extracted folder. - Run nano
./brew.sh
. - Look around, and make any changes you'd like (one useful change would be to add a line with the
mackup restore
command if you want to have the script import your app preferences automatically).
- Help! I'm getting an error saying "operation not permitted"! Don't fret; try running one of the two commands listed below:
chmod +x ~/Downloads/homebrew-time-machine-master/brew.sh
(change the directory if you've moved the script out of your Downloads folder or renamed anything)xattr -d com.apple.quarantine ~/Downloads/homebrew-time-machine-master/brew.sh
(change the directory if you've moved the script out of your Downloads folder or renamed anything)
- I'm having a problem with something else! No worries; file an issue, and I'll try to help you find a solution :)