How to Install Alpine Linux on macOS Using QEMU: A Step-by-Step Guide

Mar 17, 2025

How to Install Alpine Linux on macOS Using QEMU: A Step-by-Step Guide

Learn how to set up and boot Alpine Linux on macOS using QEMU. Follow this step-by-step guide to create a virtual machine with Alpine Linux efficiently.

Subject Matter Expert

Tanmay Soni
Tanmay SoniSenior Software Engineer - I

Virtualization is a powerful technology that allows you to run multiple operating systems on a single host system. QEMU, an open-source emulator, is an excellent tool for creating virtual machines on macOS. In this guide, we will walk you through the process of preparing an Alpine Linux image and booting it up using QEMU on your macOS system. Alpine Linux is known for its lightweight nature and security, making it an ideal choice for virtualization

Prerequisites:

  • Prior to beginning, please verify that you have already installed QEMU on your system. You can refer to the following tutorial for guidance: Getting Started with QEMU: Your Gateway to Virtual Machines.
  • Additionally, ensure you have downloaded an Alpine Linux ISO file to your system.
    You can download it from here.
  • You will also need to download the QEMU_EFI image, which can be obtained from this link.

Steps to Prepare the Alpine Linux Image and Boot the VM:

Create Disk Images:

Before you can boot the Alpine Linux VM, you need to create a disk image to install the operating system. Use the following command to create a 5GB disk image file named alpine.qcow2:

 $ qemu-img create -f qcow2 alpine.img 5G

Additionally, you'll want to create a variable storage disk image named varstore.img. This 64MB virtual disk acts as dedicated storage for temporary data and configurations used by your Alpine Linux virtual machine. In order to create vartstore.img you need to follow this command:

 $ qemu-img create -f qcow2 varstore.img 64M

Start the Alpine Linux Installation:

Use the following command to start the Alpine Linux installation:

 $ qemu-system-aarch64 -m 1024 \
   -drive if=pflash,format=raw,file=QEMU_EFI.img \
   -drive if=pflash,file=varstore.img \
   -drive if=virtio,file=alpine.img \
   -cdrom alpine-linux.iso -boot d -netdev user,id=eth0 \
   -device virtio-net-pci,netdev=eth0
  • -m 1024 specifies the VM's memory size (1GB).
  • -drive if=pflash,format=raw,file=QEMU_EFI.img line refers to the pflash disk image for EFI firmware.
  • -drive if=pflash,file=varstore.img line designates the variable storage disk image.
  • -drive if=virtio,file=alpine.img is for the main Alpine Linux disk image.
  • -cdrom alpine-linux.iso mounts the Alpine Linux ISO as a CD-ROM.
  • -boot d specifies to boot from the CD-ROM.
  • -netdev user,id=eth0 -device virtio-net-pci,netdev=eth0 configures a user-mode network connection.

Install Alpine Linux:

Once the installation is successful, and you are in the VM for first time then please run the below command to setup your VM to use Alpine-Linux.

 setup-alpine

Follow the on-screen instructions to install Alpine Linux on the virtual machine. You can choose to install it on the virtual disk you created (/dev/vda).

Boot the VM:

Once the installation is complete, shut down the VM using ^ + d, or enter poweroff and then boot the VM with your newly installed Alpine Linux using the following command - 

 qemu-system-aarch64 -m 4G -nographic \
 -drive if=pflash,format=raw,file=QEMU_EFI.img \
 -drive if=pflash,file=varstore.img \
 -drive if=virtio,file=alpine.img \
 -netdev user,id=eth0,hostfwd=tcp::2222-:22 \
 -device virtio-net-pci,netdev=eth0

Conclusion:

You have successfully prepared an Alpine Linux image and booted it up on your macOS system using QEMU. This lightweight and secure Linux distribution is ideal for various virtualization tasks. Explore Alpine Linux's package management system, build custom VMs, and enjoy the flexibility and performance of QEMU for virtualization on macOS.

Source: This blog is authored by Faiz Ahmed, Principal Technical Consultant at GeekyAnts. Originally published on Hashnode: Read here.

Subscribe to Our Newsletter

More from the engineering frontline.

Dive deep into our research and insights on design, development, and the impact of various trends to businesses.
Insight
Building Local LLMs Using Dart FFI And llama.cpp: Beyond Wrapper Packages
Sep 11, 2026

Building Local LLMs Using Dart FFI And llama.cpp: Beyond Wrapper Packages

Build local LLMs in Flutter with Dart FFI and llama.cpp, and see how native bridges, GGUF models, memory management, and token streaming enable private, on-device AI.

Insight
My Flutter App Froze With Three Photos on Screen. Here's What I Was Doing Wrong
Sep 11, 2026

My Flutter App Froze With Three Photos on Screen. Here's What I Was Doing Wrong

This blog explains how rethinking Flutter’s image-processing architecture fixed severe performance issues and improved rendering efficiency.

Insight
Building a Production-Ready Canva-like Editor with Konva.js, React 19 and Next.js 15
Sep 10, 2026

Building a Production-Ready Canva-like Editor with Konva.js, React 19 and Next.js 15

This blog explains how to build a production-ready canvas editor with Konva.js, React, and Next.js, covering architecture, performance, and key engineering decisions.

Insight
What a PHP-to-NestJS Banking Migration Taught Us About Architecture, Security, and Trust
Sep 8, 2026

What a PHP-to-NestJS Banking Migration Taught Us About Architecture, Security, and Trust

This blog explores the architecture, security, performance, and documentation lessons from migrating a legacy PHP/Laravel banking platform to NestJS.

Insight
Building Production-Grade Video Thumbnail Scrubbing in the Browser: HLS, Frame Extraction, Caching, and Performance Trade-offs
Sep 7, 2026

Building Production-Grade Video Thumbnail Scrubbing in the Browser: HLS, Frame Extraction, Caching, and Performance Trade-offs

This blog explains how to build responsive video thumbnail scrubbing in the browser for local files and HLS streams, covering frame extraction, caching, and performance trade-offs.

Insight
The Agent Can See Your App. How Often Can It Look?
Sep 4, 2026

The Agent Can See Your App. How Often Can It Look?

AI coding agents can now interact with mobile apps, but their effectiveness depends on iteration speed. This blog explores how React Native architecture influences feedback loops and AI-driven developer productivity.

Insight
Building Interactive Cards from Design JSON Without Killing Your Feed: Overlays, Video, Mute/Unmute, and Lag-Free Lists
Sep 1, 2026

Building Interactive Cards from Design JSON Without Killing Your Feed: Overlays, Video, Mute/Unmute, and Lag-Free Lists

Learn how to turn design JSON into interactive, video-enabled cards using overlays, smart media controls, caching, and virtualization without slowing down high-cardinality feeds.

The Right Conversation Can

Save You Six Months.

Book a call
How to Install Alpine Linux on macOS Using QEMU: A Step-by-Step Guide - GeekyAnts