Skip to content
Related Articles

Related Articles

How to Install Rasterio on MacOS?

View Discussion
Improve Article
Save Article
  • Last Updated : 30 Sep, 2021
View Discussion
Improve Article
Save Article

In this article, we will learn how to install Rasterio in Python on MacOS. Rasterio is used to access geospatial raster data.

Geographic information systems use GeoTIFF and other formats to organize and store gridded raster datasets such as satellite imagery and terrain models. Rasterio reads and writes these formats and provides a Python API based on Numpy N-dimensional arrays and GeoJSON


Method 1: Using pip to install Rasterio Package

Follow the below steps to install the Rasterio package on macOS using pip:

Step 1: Install the latest Python3 in MacOS

Step 2: Check if pip3 and python3 are correctly installed.

python3 --version
pip3 --version

checking python and pip version in macos

Step 3: Upgrade your pip to avoid errors during installation.

pip3 install --upgrade pip

upgrading pip in macos

Step 4: Enter the following command to install Rasterio using pip3.

pip3 install rasterio

installing Rasterio package on macOS using pip

Method 2: Using to install Rasterio 

Follow the below steps to install the Rasterio package on macOS using the file:

Step 1: Download the latest source package of Rasterio for python3 from here.

curl > rasterio.tar.gz

downloading the source package for Rasterio in macos

Step 2: Extract the downloaded package using the following command.

tar -xzvf rasterio.tar.gz

extracting the rasterio.tar.gz file in macos

Step 3: Go inside the folder and Enter the following command to install the package.

Note: Run the following two commands in terminal before installing via

Install homebrew before running the below command.
brew install gdal

install gdal via brew

pip3 install GDAL

install gdal via pip3

Note: You must have developer tools for XCode MacOS installed in your system

cd rasterio-1.2.8
python3 install

installing Rasterio on macOS using the file

Verifying Rasterio installation on macOS:

Make the following import in your python terminal to verify if the installation has been done properly:

import rasterio

Verifying Rasterio installation on macOS

If there is any error while importing the module then is not installed properly.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!