How to Install QGIS with Homebrew on macOS23 Jun 2016
This post explains how I installed the QGIS open source Geographical Information System software on macOS El Capitan using the Homebrew package manager. These are the results of my trial and error attempts to get QGIS installed and running smoothly without errors.
My successful installation of QGIS followed these steps:
- Install GDAL using Homebrew
- Install Python using Homebrew
- Install Python packages using Pip
- Install QGIS using Homebrew
Installing GDAL using Homebrew
QGIS requires the Geospatial Data Abstraction Library (GDAL) to be installed. I installed GDAL with Homebrew:
Installing Python using Homebrew
QGIS requires the Python language and some Python packages to be installed. Although macOS has a version of Python, unfortunately it doesn’t come with the Pip package manager, which makes it easy to install Python packages.
I could have installed Pip using the
easy_install tool that comes with the system Python, but this method requires using
sudo. I’ve written previously about why using
sudo to change the system version of Ruby is a bad idea and the same reasoning applies to changing the system version of Python. TL;DR - don’t do it.
The Homebrew version of Python comes with Pip so I installed Python using Homebrew:
Installing Python with Homebrew gives us a version of Python that’s separate from the system Python, so any changes we make to the Homebrew version of Python won’t adversely affect macOS.
Installing Python Packages using Pip
QGIS requires matplotlib, the Python 2D plotting library, so I installed the matplotlib package with Pip:
At this stage, Python was installed and ready to go with the packages required by QGIS.
Installing QGIS using Homebrew
I installed the Homebrew-osgeo4mac version of QGIS 2.8.9, which is the current stable long term release (LTR).
I began the installation by adding the
osgeo/osgeo4mac GitHub repository to the list of sources for Homebrew packages (as per the instructions):
Although the following command should install the Homebrew-osgeo4mac version of QGIS:
it returned the following error:
brew install osgeo/osgeo4mac/gdal-grass64 command just gave me the same error and the same suggested solution. Time to move on.
The installation was failing when attempting to install Grass, which is a set of tools for "geospatial data management and analysis, image processing, graphics and maps production, spatial modeling, and visualization." I felt I could live without Grass so I installed QGIS without it:
This step succeeded and QGIS was finally installed. As a final step I issued the following command to make QGIS show up in the
These are the steps that worked for me to produce a clean and error free installation of QGIS 2.8.9 (LTR) using Homebrew. I hope they save you time if you want to install QGIS on macOS El Capitan using Homebrew.