How to Install Podman on macOS

March 17, 2022

Introduction

For most developers and DevOps professionals, Docker is a platform synonymous with app containerization. However, other projects aim to diversify the offer in the container management market, and Podman is one open-source project that has recently become popular.

This article will show you how to install Podman on macOS using Homebrew.

How to install Podman on macOS.

Prerequisites

  • A system running macOS Catalina or higher.
  • Access to the terminal.
  • A user with admin-level privileges.

Installing Podman on macOS

Podman does not run natively on macOS because it manages only Linux containers. On macOS, Podman interacts with the containers that run in a Linux VM. The easiest way to set up the necessary packages for Podman is to use Homebrew.

STEP 1: Install Homebrew

Homebrew is a command line package manager for macOS.

To install Homebrew on macOS, you will need to install XCode Command Line tools and then download the installation script by running:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

For a step-by-step Homebrew installation tutorial, read How to Install Homebrew on Mac.

STEP 2: Install Podman Using Homebrew

1. Before installing Podman, update the Homebrew formulae:

brew update

The output shows if there are formulae to be upgraded.

Updating the Homebrew repositories.

If necessary, perform the upgrade with brew upgrade.

2. Next, install Podman by running the following command:

brew install podman

Homebrew downloads the necessary dependencies and installs Podman.

Installing Podman using Homebrew.

STEP 3: Start Podman

1. When the installation finishes, prepare the Podman virtual machine by typing:

podman machine init

The system downloads the virtual machine and sets it up.

Setting up the Podman virtual machine.

2. Enter the following command to start Podman:

podman machine start

The output confirms the system started the Podman machine successfully.

Starting the Podman machine.

Testing Podman on macOS

1. Test the Podman installation by creating an Nginx container. The example below clones Alpine Nginx from GitHub:

git clone http://github.com/baude/alpine_nginx && cd alpine_nginx
Cloning an Nginx image using Git.

2. Use the podman build command to create an Nginx image on the system:

podman build -t alpine_nginx .
Building an Nginx image using Podman.

3. Wait for the process to finish, then create an Nginx container with podman run:

podman run -dt -p 9999:80 alpine_nginx
Running an Nginx container using Podman.

Note: The podman run has the same syntax as docker run.

4. Check running containers by typing:

podman ps -a

The output lists the Nginx container:

Listing the running containers in Podman.

5. Use the curl command to test the connection with the container:

curl http://localhost:9999

The command returns a response from Nginx:

Using the curl command to test a Podman container.

Note: Bare Metal Cloud general purpose instances offer compute, memory, and network resources well suited for running containerized microservices.

Using Podman on macOS

Podman on macOS is run using a set of commands that mirror Docker commands. The following are some useful commands to get started with Podman:

CommandDescriptionExample
podman search [image-name]Search repositories for an image.podman search ubuntu
podman pull [image-name]Pull an image from a repository.podman pull docker.io/library/ubuntu
podman imagesList locally available images.podman images
podman run [image-name]Create and run a container using an image.podman run -dt -p 8080:80 docker.io/library/ubuntu
podman stop [container-id]Stop a running container.podman stop ca0ecf758897
podman rm [container-id]Remove a container.podman rm ca0ecf758897
podman rmi [image-name]Remove an image.podman rmi docker.io/library/ubuntu
podman infoReceive information about the Podman installation.podman info

If you are new to Podman, check out our Podman tutorial article for beginners to get you started.

Conclusion

This tutorial explained how to install Podman on macOS using the Homebrew package manager. Furthermore, it showed a test example of deploying a container with Podman, along with some commonly used commands.

If you are interested in containers, read about the Benefits of Container Orchestration.

Was this article helpful?
YesNo
Marko Aleksic
Marko Aleksić is a Technical Writer at phoenixNAP. His innate curiosity regarding all things IT, combined with over a decade long background in writing, teaching and working in IT-related fields, led him to technical writing, where he has an opportunity to employ his skills and make technology less daunting to everyone.
Next you should read
Podman vs Docker: Everything You Need to Know
December 12, 2023

This article will compare two container management engines - Docker and Podman.
Read more
Docker vs containerd vs CRI-O
March 10, 2022

Container deployment is a practical method for ensuring portability, scalability, and agility in the DevOps world.
Read more
What is Docker?
January 17, 2024

Docker is one of the most popular container-based platforms attracting the attention of many development teams. This article will explain what Docker is, and...
Read more
Docker Image vs Container: The Major Differences
May 23, 2024

Although the software is relatively simple to master, there are some Docker-specific terms that new users...
Read more