This page is now out of date, an updated version is available here.
Brew remove packageName As you may have guessed by now, the remove and uninstall commands are exactly the same, and get the same result; the removal of the Homebrew package. For example, to remove and uninstall Telnet (assuming you installed telnet on the Mac with Homebrew anyway), you would use the following command string. HPC Mac OS X offers GCC builds, which include gfortran MacPorts (package name, e.g., 'gcc48') - the fastest way to get a developer version of GCC. MacPorts comes with a packing software, but all software is compiled before installation. For the developer version, the 'Portfile' is updated approx.
I’ve recently needed to set up a new Mac and I realised that the current installation process for all the applications, tools, chemistry toolboxes, and associated dependencies was unmanageable. I have a mixture of apps that I have compiled myself, others that I have simply used the precompiled binaries, others from Macports etc.
So I decided to start over and try Homebrew.
Installation of Homebrew
Homebrew is a package manager for Mac OSX that installs packages in it’s own directory then symlinks the files to /usr/local. The reason I went with Homebrew rather than MacPorts is that I found on occasions MacPorts overwrote existing files. Homebrew instead warns you of any clashes and allows you to decide which version to keep. If you need to remove MacPorts there is a detailed guide. You may also need to update your BASH profile.
To install Homebrew you first need to have access to the command line tools for Xcode, the easiest way to do this is to download Xcode from the Mac Appstore
- Start Xcode on the Mac.
- Choose Preferences from the Xcode menu.
- In the General panel, click Downloads.
- On the Downloads window, choose the Components tab.
- Click the Install button next to Command Line Tools. You are asked for your Apple Developer login during the install process.
Or You can download the Xcode command line tools directly from the developer portal as a .dmg file. https://developer.apple.com/downloads/index.action. On the 'Downloads for Apple Developers' list, select the Command Line Tools entry that you want.
For many scientific applications you will also need X11, the easiest way to get this is to install XQuartz. The XQuartz project is an open-source effort to develop a version of the X.Org X Window System that runs on OS X. Together with supporting libraries and applications, it forms the X11.app. the latest downloads are available here
To install Homebrew type this command in the Terminal
The 'brew doctor' command checks everything is fine. e.g. it will warn if the developer tools are missing, and if there are unexpected items in /usr/local/bin and /usr/local/lib that may clash and might need to be deleted.
I got this message
Brew Gfortran インストール
Most of these are from my previous installation of OpenBabel and needed to be deleted. Don’t worry if you forget to delete a file, when you come to the brew install of that package it will first check and warn you of any files should be removed.
Installing packages using Homebrew
The way Homebrew works is it installs everything to /usr/local/Cellar, then creates aliases in /usr/local/bin and /usr/local/lib so they are on your $PATH. You will likely have stuff manually installed in these directories - this is fine, but if they are things that can be installed using homebrew it's best to delete them and then reinstall using homebrew.
It is a good idea to first update the package list
Then we can just run 'brew install
gfortran is now part of gcc we can check gfortran is installed, in the Terminal type
and the location
which should be an alias to '/usr/local/Cellar/gcc/4.8.3/bin/gfortran'.
To install a range of cheminformatics packages we can use a custom “tap” created by Matt
Now outdated see below
There is already an (outdated) open-babel formula in the main homebrew repository, so use the full path, the 'mcs07/cheminformatics' part is required because of the old outdated open-babel formula in the main homebrew repository which clashes. The '--HEAD' part means install the latest development version from GitHub. This isn't ideal, but the latest version available as an installer is the 2.3.1 version is so outdated now that there are problems compiling it on Mavericks.
If you have previously installed Openbabel using
The '--HEAD' part means install the latest development version from GitHub. The latest version of OpenBabel is now available so can be installed directly.
You may get errors something like
I deleted the highlighted files, then
There are a couple of applications that rely on OpenBabel we can now install
So what have we installed
cdk is The Chemical Development Kit a scientific, LGPL-ed library for bio- and cheminformatics and computational chemistry written in Java
chemspot is ChemSpot is a set of tools for named entity recognition and classification of chemicals in natural language texts, including trivial names, abbreviations, molecular formulas and IUPAC entities.
indigo Indigo is an organic chemistry toolkit
inch InChi is a non-proprietary, international standard to represent chemical structures.
opsin Opsin is an Open Parser for Systematic IUPAC nomenclature.
osra Osra Optical Structure Recognition Application is a utility designed to convert graphical representations of chemical structures and reactions, as they appear in journal articles, patent documents, textbooks, trade magazines etc., into SMILES or MOL files.
rdkit RDKit is Open-Source Cheminformatics and Machine Learning toolkit
filter-it, strip-it, align-it, and shape-it are a set of tools created by Silicos-it they are built on top of OpenBabel open source C++ API for rapid calculation of molecular properties
Filter-it™ is a command-line program for filtering molecules with unwanted properties out of a set of molecules
Strip-it™ is a tool to extract molecular scaffolds according predefined rules based on definitions as described by Murcko (J. Med. Chem. 1996, 39, 2887), Pollock (J. Chem. Inf. Model. 2008, 48, 1304) and Schuffenhauer (J. Chem. Inf. Model. 2007, 47, 47)
Align-it™ is a pharmacophore-based tool to align molecules by representing pharmacophoric features as Gaussian 3D volumes.
Shape-it™ is a shape-based alignment tool that represents molecules as a set of atomic Gaussians. The software is based on the alignment method described by Grant and Pickup (J. Phys. Chem. 1995, 99, 3503).
PYMOL can also be installed using Homebrew
This installation switches the stereo/mono graphics paradigm. Recent builds of OSX with intel chips seem to crash with stereo graphics. Therefore, Homebrew-installed pymol defaults to assuming the '-M' flag has been passed to it. You can switch to stereo graphics with the '-S' flag when you start PYMOL.
You will also need a number of python bindings to access the toolkits from python scripts, to do this we use PIP a tool for installing and managing Python packages.
And then everything is up to date.
Then install using
UpdateI’ve heard of issues with installing pycairo using PIP, if you have problems try
Checking it all works
We can now test the applications are working, to test Opsin in a Terminal window type:
To check that the rdkit python bindings are working: Type 'python' to enter the python interpreter, then try:
To check OpenBabel is working type this in a Terminal window:
To test InChi type this in the Terminal:
To test chemspot in the Terminal type (change username to your name), beware chemspot is pretty resource hungry.
This will create a file on your desktop called test.txt, now type the following
Chemist’s measure atomic particles using a large QUANTITY called the mole. One mole is equal to 0000 or 6.022 x 10 23 particles. Scientists have defined a mole as the number of carbon atoms in exactly 12 grams of carbon-12. This number is called AVOGADRO’S NUMBER. The mole designates an extremely large number of units, 6.02214076 × 10 23. The General Conference on Weights and Measures defined the mole as this number for the International System of Units (SI) effective from May 20, 2019. The mole was previously defined as the number of atoms determined experimentally to be found in 12 grams of carbon -12. A mole fraction indicates the number of chemical elements. One mole of any substance is equal to the value of 6.023 x 1023 (Avagadro number). It can be used to measure the products obtained from the chemical reaction. The unit is denoted by mol. Chemistry mole and avogadro's number.
This will create a file on your desktop called untitled.txt
If you open it in a text editor it should read
To test OSRA you will need an image of chemical structure, you can drag the image below to your desktop.
Then in the Terminal type:
For some reason screenshots don’t work at present, a workaround is to open the screenshot image in Preview and save it as a jpeg file.
Or it can be done from the command line using GraphicsMagick
To test filter-it (and the other tools from silicos-it) in the terminal type
Chembl_beaker package was developed at ChEMBL group, EMBL-EBI, Cambridge, UK.It is a wrapper for RDKit and OSRA, which exposes the following methods:
- Format convertion
- Compound recognition
- Raster image (PNG) generation
- Vector image (SVG) generation
- HTML5 ready compound representation
- Maximum Common Substructure
- Smiliarity maps
- ChEMBL standardisation process, consisting of neutralisation, bond breaking, salt removal and applying various rules.
- 3D coordinates generation, using Universal Force Field
- Various other calculations (for example kekulisation)
- Marvin 4 JS compilant webservices
Brew Install Gfortran
As a portable, lightweight, CORS-ready, REST-speaking, SPORE-documented webserver. This particular implementation wraps RDKit in Bottle on Tornado.To start the web server, in a Terminal window type
The open a web browser and type in the URL
and you should see the following
If you select smiles23D/:CTAB and type in a SMILES string and click on the green “GET” button you should see the following response.
Installing Open Drug Discovery Toolkit (ODDT): a new open-source player in the drug discovery field
A recent paper in J Cheminformatics described Open Drug Discovery Toolkit (ODDT): a new open-source player in the drug discovery field DOI a free and open source tool for both computer aided drug discovery (CADD) developers and researchers. Open Drug Discovery Toolkit is released on a permissive 3-clause BSD license for both academic and industrial use. ODDT’s source code, additional examples and documentation are available on GitHub.
ODDT (Open Drug Discovery Toolkit)
Programming language: Python
at least one of the toolkits:
Brew Uninstall Gfortran
ffnet (0.7.1+), only for neural network functionality.
Installation of the toolkits using Homebrew is described above.
The easiest way to install ODDT on a Mac is to use PIP
You may get messages suggesting you upgrade some of the dependencies such as scipy, this can be done using PIP
pip install —upgrade scipy
You can easily check all is working by running python in a terminal window
The publication also includes a series of iPython notebooks to get you started.
When El Capitan first came out I upgraded a machine with an existing installation of a variety of cheminformatics tools installed using Homebrew and PIP as described aboveUnder this situation Pymol worked without problem. However I have had a few readers email me saying they are having problems with Pymol so I took a new machine running El Capitan and tried to install the same cheminformatics tools including Pymol using Homebrew and PIP. All worked fine except Pymol which opened but crashed with the following error.
The helpful on the Pymol user list pointed me to this message on the Homebrew-Science issues
First uninstall pymol and libpng
then install pymol first.
If you now type Pymol in a Terminal window it should start fine.
Updated 12 December 2017
For a long time,
gfortran support on macOS could be achieved by installing the homebrew cask
brew cask install gfortran.
As of 2021, both the
brew cask command and the cask
gfortran are deprecated.Users who have installed this cask already won’t notice as things will continue to work as normal.Only new users who want to install
gfortran this way will get the message that the cask is “not available”.The cask was removed in December 2020 and merged into the
gcc formula (which can be installed via
brew install gcc).Now, one could go to https://github.com/fxcoudert/gfortran-for-macOS/releases and install the respective
.dmg file manually.However, this is not a long-term approach and usually one would like to do this via
brew, the most popular package manager for macOS.
Unfortunately, this change did not result in a smooth experience for R users who want to compile packages from source that require a functional
gfortran compiler.This requirement does not occur very often as most users install R package binaries on macOS.These don’t require a working
However, in some cases when calling
install.packages(), a working
gfortran installation is needed.And if
type = 'source' is used it needs to be there.
Brew Upgrade Gfortran
The issue after the integration of
gfortran into the
gcc formula is that the official R binary installer for macOS expects the
gfortran installation at
/usr/local/gfortran.This was fulfilled by the old
gfortran cask but is not by the new
gcc integration.Hence, trying to install the “cluster” package via
install.packages('cluster', type = 'source') fails and complains about not being able to find
There was a discussion about these changes in the homebrew PR but the comments mentioning potential upcoming issues were not really heard.Also some workarounds posted in the thread do not work.
So how does one now install
gfortran on macOS these days?
It is likely that the workaround presented below will not be needed at some point in the future as it will probably be fixed in the R installer at some point (hopefully).In the meantime, the following helps:
Brew Link Gfortran
Create a file
~/.R/Makevars(if it does not exist yet)
Add the following to
Test the changes by calling
install.packages('cluster', type = 'source')
The output should look like this
Caution: After using this approach for some days, I have seen issues with certain packages (e.g.
hsdar).It is unclear to me if the issues trace back to the packages or the new way of using
gfortran.You might want to re-think using the approach proposed here and eventually install the linked standalone
gfortran binary shown earlier in this post binary manually.
- I am not sure about the
ld: warning: object file (dysta.o) was built for newer macOS version (11.2) than being linked (11.0)warning but it does not seem to have a practical impact.
- This approach was tested with R 4.0.4, macOS 11.2.3 in March 2021
- If you still have the old
gfortrancask installed, you may want to switch to the new approach as the cask is no longer being updated. Hence you will run a very outdated
gfortranas some point without noticing. You can remove the old cask with
brew remove – cask gfortran.