How To Install Linux On A Mac

How To Install Linux On A Mac

Reading time1 min
#Linux#Mac#DualBoot#LinuxInstallation#MacLinux

How To Install Linux On A Mac: Dual Boot, Performance, and Practical Insights

Dual-booting Linux on Apple hardware transforms the Mac into a powerful, flexible engineering platform—without sacrificing access to macOS. MacBooks, particularly models with Intel CPUs (2015–2019), offer excellent Linux compatibility with the right preparation. Apple Silicon (M1/M2) requires workaround-heavy workflows; it's possible, but not always recommended for mission-critical deployments.


When Does Linux on a Mac Make Sense?

Some workloads—custom kernel testing, direct hardware control, container orchestration, or CI agents—run better natively than inside a VM. macOS limits package managers and system access, whereas a native Linux environment enables:

  • Full control of kernel modules and drivers
  • Native package access (apt, dnf, pacman) for GCC, Docker, KVM, and networking tools
  • Full scripting/programming stack isolation outside macOS's walled garden

Trade-off: Apple firmware updates sometimes break bootloaders or partition layouts. Always keep a recovery drive.


Prerequisites

  • Intel Mac (tested: MacBook Pro 2018, Mac mini 2014, iMac 2015; Apple Silicon see note below)
  • USB drive, ≥8GB, reliable (SanDisk, Kingston; avoid free conference swag drives—write failures mid-install cause headaches)
  • Latest macOS backup (Time Machine or rsync snapshot)
  • Linux ISO, e.g. ubuntu-22.04.4-desktop-amd64.iso
  • rEFInd 0.14.0 (recommended for boot management)
  • Robust WiFi or Ethernet (some Mac WiFi chips need custom drivers)

Note on Apple Silicon (M1/M2)

Linux support on M1/M2 via Asahi Linux exists, but with limited GPU/Thunderbolt and sleep support. For production, stick to Intel Macs for now.


1. Data Backup: Non-Negotiable

Disk manipulation is inherently destructive. Use Time Machine or tmutil to create a snapshot:

sudo tmutil listlocalsnapshots /

External backup: rsync -a --exclude=/Volumes / /Volumes/YOUR_BACKUP_DRIVE


2. Disk Space Preparation

  • Boot macOS.

  • Launch Disk Utility (diskutil list in Terminal for device mapping).

  • Shrink APFS container by 40–100GB (realistically, 60GB for development workloads):

    1. Select main internal disk
    2. Click Partition
    3. Add a new partition, leave it as "Free Space". Disk Utility may require a reboot; don’t format from macOS—let Linux do this.

Gotcha: macOS sometimes “heals” unallocated space on reboot. Immediately proceed to install after shrinking.


3. Create a Bootable USB Installer

On macOS, prefer balenaEtcher or dd (careful):

sudo dd if=ubuntu-22.04.4-desktop-amd64.iso of=/dev/rdisk2 bs=4m

Check the device path with diskutil list to avoid overwriting system disks.


4. Configure Firmware Settings

Intel Mac:

  • Reboot, hold Command + R to enter Recovery.
  • Utilities > Startup Security Utility:
    • Secure Boot: set to No Security (temporary; re-enable post-setup if possible)
    • Allow booting from external media

Apple Silicon:

  • Shutdown, hold Power until options appear
  • Options > Utilities > Startup Security
  • Allow external boot; reduced security

5. Boot from Installer

Insert USB, reboot, hold Option/Alt until Apple’s boot picker appears. Choose “EFI Boot” (your USB drive).
If it doesn’t show, disconnect other USB devices; some hubs confuse the boot picker.


6. Install Linux Alongside macOS

  • Start installer: e.g., Ubuntu 22.04 LTS
  • At partitioning step, pick “Manual / Something Else”.

Typical setup:

  • /boot/efi: do NOT reformat; use existing 200MB–500MB EFI partition
  • / (ext4): 40–80GB
  • swap: optional, usually 2–8GB (systemd uses zram by default now)
  • /home (optional): create another partition if you expect frequent reinstalls

When the installer asks about the EFI partition, mount but do not format.
Install GRUB to the same EFI partition (/dev/disk0s1 or /dev/sda1).
Proceed; expect install to take 10–30 minutes, depending on USB speed.


7. First Boot & Boot Manager: rEFInd

Native GRUB on Macs is unreliable. rEFInd covers the edge cases. Install via macOS:

brew install --cask refind
sudo refind-install

rEFInd autodetects all bootable OSes and provides a graphical selector at startup.

Known issue: Sometimes firmware resets the default boot to macOS after updates. Use bless or rEFInd’s script to restore.


8. Post-Install Hardware Setup

Hardware quirks—WiFi and touchpad especially.

Common driver fixes (Ubuntu example):

WiFi (Broadcom):

sudo apt update
sudo apt install bcmwl-kernel-source

Touchpad (no multitouch): Check xinput list
GPU: Intel GPUs work out of the box. Radeon/Nvidia: use mesa with open drivers or install proprietary drivers as needed.


9. Data Exchange & Workflow

  • For shared storage, create an exFAT partition from Disk Utility, mountable from both OSes.
  • Avoid writing to macOS APFS from Linux—risk of data corruption.
  • Backups: Cloud or NAS recommended; dual-boot setups complicate local snapshots.

Troubleshooting Table

ProblemSolution
USB doesn’t appear at bootRecheck Secure Boot, reflash installer, swap USB ports/hubs
GRUB not visible in rEFIndSometimes requires refind-mkdefault or re-installation
No WiFi post-installIdentify chipset, install specific kernel module
Disk errors during partitioningRemove unneeded APFS volumes from Disk Utility pre-install

Logs matter. For boot failures:

  • Inspect /var/log/syslog (Linux), or use Mac’s recovery/Verbose F12 mode.
  • Partial output: grub_install: error: cannot find EFI directory.
    • Usually a missing EFI partition mount during installation.

Non-Obvious Workflow Tip

If you automate provisioning (dotfiles, dev tooling), treat each OS as an independent node. Use Ansible or a bootstrap script to enforce config parity; don’t rely on shared home directories.


Conclusion

A properly configured Mac/Linux dual-boot offers engineering flexibility with few compromises, as long as you understand the firmware, partitioning, and peripheral management realities. For production reliability, Intel Macs currently have the broadest support.

Further discussion: contribute edge case reports or hardware-specific tips below. Testing on 2020 MacBook Air (Intel) or Mac mini (M1)? Asahi Linux is improving, but not all features are stable yet.