Homebrew is the best package manager for Mac. Before installing brew make sure XCode is installed. Nowadays, I have switched to Spack for installing scientific software since brew does not have all the things that I need. I only install a few packages from brew, see below.

You need to install command line tools before installing packages with homebrew. Note that you do not need to install XCode. Apple's Command Line Tools can be installed on recent OS versions by running this command in the Terminal

xcode-select --install

Run doctor to check that your setup is ok before installing any packages

brew doctor

Sometimes you may have to delete existing tools and then upgrade

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

Here are some useful commands.

brew install gcc          -- Install some package, e.g., gcc
brew uninstall gcc        -- Uninstall a package
brew info gcc             -- Check package information
brew list                 -- List all installed packages
brew list gcc             -- Show files installed by gcc
brew list --verbose gcc   -- Same as above but more detailed
brew update               -- Update package list (needs internet connection)
brew outdated             -- See outdated packages
brew upgrade              -- Upgrade all outdated packages
brew upgrade -n           -- Do dry run of upgrade
brew upgrade gcc          -- Upgrade a specific package
brew cleanup              -- Remove old versions of packages
brew deps gcc             -- Check dependencies for gcc
brew uses --installed gcc -- Check which installed packages depend on gcc
brew leaves               -- List packages not required by any installed package

We will only install some basic packages from Homebrew and the rest of the scientific softwares using Spack.

brew install aspell
brew install astyle
brew install chapel
brew install colordiff
brew install diffr
brew install dos2unix
brew install enscript
brew install ffmpeg
brew install gcc
brew install gv
brew install gnuplot
brew install ispell
brew install subversion
brew install wget
brew install youtube-dl

Install specific version of gcc

brew install gcc@9

Pin a package to prevent it from being upgraded

brew pin gcc@11

You can see pinned packages

brew list --pinned

Do not install any MPI library since we will install it with Spack.

There not many scientific softwares available in brew. Some of the available ones are:

hdf5-mpi (conflicts with hdf5)
suite-sparse (contains umfpack)

Binary apps

All of these are installed into the /Applications directory.

brew install alfred
brew install amazon-music
brew install appcleaner
brew install coconutbattery
brew install djview
brew install dropbox
brew install firefox
brew install google-drive
brew install iina
brew install inkscape
brew install keepassxc
brew install lastpass
brew install lyx
brew install mactex
brew install meld
brew install onyx
brew install paraview
brew install sourcetree
brew install skype
brew install texmacs
brew install texstudio
brew install visit
brew install visual-studio-code
brew install xquartz
brew install yed
brew install zoom
brew install zotero

Some apps are available as both bottles and casks, and I prefer to install cask versions and they install into /Applications folder.

brew install --cask docker
brew install --cask julia
brew install --cask macvim
brew install --cask miniforge     # installs conda python

To install Octave

brew tap octave-app/octave-app
brew install --cask octave-app