Homebrew (A Package Manager for Mac)
For organic chemists, Homebrew is a very useful software, although it is not as essential as MS Office or ChemDraw. Homebrew is a package management system for Mac. Herein, I would like to explain how to build an environment on a Mac using Homebrew.
- Homebrew
Homebrew is a package management system used from a terminal (software to type commands). You can easily install various UNIX-based softwares by Homebrew.
- iTerm2
iTerm2 is a widely used terminal for Mac. It is more powerful than the standard terminal. Homebrew can be used from iTerm2 (also from the standard terminal). It is useful to run Gaussian, python, etc. on a Mac and to connect to remote servers.
Building an Environment with Homebrew
Installation of Homebrew
Homebrew is installed from Terminal with commands. Terminal can be found in Launchpad.
Below is the Terminal screen. Type a command here to install Homebrew.
First, before installing Homebrew, command line tools should be installed. Open terminal and type the following command ($ is not included). (Added on April 7, 2021)
$ xcode-select --install
The command to install Homebrew changes occasionally, so check the Homebrew site (https://brew.sh/) and enter it in the terminal (as of May 24, 2020, the following command is available. $ is not included). Enter your login password if required.
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
It takes a while to install Homebrew. After the installation, run the following commands in the terminal.
$ brew doctor
If you run it and there is no error, you have succeeded. It’s a kind of strict check, so even if an error appears, it often works without a problem.
How to Use Homebrew
$ brew update #update Homebrew
$ brew upgrade #upgrade applications installed by Homebrew
$ brew install hogehoge #command to install hogehoge
It is better to run “brew update” and “brew upgrade” occasionally.
Installation of iTerm2
You can easily install iTerm2 by using the brew cask command.
$ brew install --cask iterm2
After the installation, commands are entered from iTerm2, not from the terminal.
You can change the default color scheme of iTerm2 as you like. Change it from Color Presets in [Preferences]-[Profiles]-[Colors]. My setting is Pastel as you can see below.
Installation of zsh and etc.
Enter the following commands into iTerm2 to install the major programs.
$ brew install vim zsh coreutils wget gcc openssl
The latest version of vim, zsh, etc. will be installed.
(For Macs before Mojave) Open iTerm2 and select [iTerm2]-[Preferences]-[Profiles]-[General], and choose Command from the pull-down list, and type zsh to the right of it. For Catalina, zsh is the default shell, so this operation is not necessary.
Settings for zsh
You can configure zsh by creating a .zshrc file in your home folder (/Users/<username>/). Add the following to your .zshrc
# Aliases
alias vi=vim
# path
export PATH=/usr/local/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH
Installation of Dropbox, Evernote, Google Chrome, Skitch by brew cask
With brew cask, you can easily install Dropbox, Evernote, Google Chrome, Skicth, etc. from the command line. You do not need to download each package at all.
$ brew install --cask dropbox evernote google-chrome skitch
Installation of VSCode by brew cask
You can also install VSCode, a cool text editor, with brew cask.
$ brew install --cask visual-studio-code
Installation of XQuartz
If XQuartz is not installed, some applications such as Mercury will not start. It is better to be installed in your Mac. You can easily install it with brew cask command.
$ brew install --cask xquartz
Installation of FileZilla
FileZilla, which is used for FTP connections to remote servers, can also be easily installed with Homebrew.
Now, Filezilla cannot be installed by Homebrew. Filezilla should be download from the download site.
$ brew cask install filezilla
Installation of Other Softwares
The following softwares cannot be installed by Homebrew, so you need to install them manually.
- Microsoft Office
- ChemDraw
- Gaussian & GaussView
- Mercury
Freeware for viewing cif files. You can download it from The Cambridge Crystallographic Data Centre (CCDC). - CYLView
Freeware for viewing and visualizing calculated chemical structures. You can download if from cylview.org.