← Guides

Free up RAM on a Mac used for development

By , who makes Ramback · Updated

On a Mac used for development, most of the memory goes to tools that keep running after you stop using them: simulators, emulators, the Docker VM, Gradle daemons and dev servers. Stopping them is what frees RAM. Memory cleaners and sudo purge don't, because the memory belongs to processes that are still running.

Check whether you're actually short

Look at memory pressure and swap, not Memory Used. macOS fills spare RAM with cached files on purpose and drops them the moment an app needs room, so a Mac showing 15 of 16 GB used can be perfectly fine. You're short when the Memory Pressure graph in Activity Monitor turns yellow or red, or when swap keeps growing past a few gigabytes. From Terminal:

# how much memory macOS counts as free
memory_pressure | tail -1

# how much has gone to swap
sysctl vm.swapusage
System-wide memory free percentage: 23%
vm.swapusage: total = 6144.00M  used = 4505.75M  free = 1638.25M  (encrypted)

A free percentage that stays in the teens or lower while swap grows means macOS is writing memory to disk to make room, and everything gets slower.

What holds the memory on a dev Mac

These are the usual suspects. Each one is cheap to start again, which is why it's easy to leave five of them running.

WhatTypical sizeStop it with
iOS simulatorAbout 1.5 GB each, idlexcrun simctl shutdown all
Android emulator2–4 GB eachadb emu kill
Docker VMUp to its memory limit, even with no containersQuit Docker Desktop, orb stop, colima stop
Gradle and Kotlin daemons1–2 GB each, for 3 idle hourspkill -f GradleDaemon
Dev serversA few hundred MB to over 1 GB eachkill the PID on the port
AI agent sessionsAbout 0.4–0.5 GB each, plus the servers they startEnd sessions you've finished with
Xcode's build serviceOften over 1 GB after a buildQuit Xcode

Each name links to a guide with the full commands and the settings that make it smaller.

Why memory cleaners and purge don't help

sudo purge empties the file cache, which is memory macOS would have handed to the next app that asked anyway. Memory Used drops for a moment, then fills up again. The memory in the table above belongs to running processes, and nothing gets it back without stopping them. A cleaner that doesn't know what a simulator or a Gradle daemon is can't stop them safely.

Finding them in Activity Monitor

Activity Monitor lists all of these, under names that don't say what they are. An Android emulator is qemu-system-aarch64. The Docker VM is com.apple.Virtualization.VirtualMachine. A Gradle daemon is java. A simulator is dozens of small processes rather than one big one, so it never tops the list. Sort the Memory tab by Memory, and use the commands in the table instead of Quit, so each tool shuts down cleanly. What the dev processes in Activity Monitor are covers the rest of the names.

What to stop first

Leave databases and anything in the middle of a build alone. Stopping a database can lose data that wasn't written yet, and a stopped build just runs again from the start.