~/t/g/mac $

Android emulators filling your Mac? Move AVD storage

gist Back up each virtual device, move its data folder, and check its registration and launcher settings before deleting old copies.

contents
  1. Step 1: Separate SDK and AVD storage
  2. Step 2: Find the current files and check the SSD
  3. Step 3: Back up and move one virtual device
  4. Step 4: Set the AVD home for the launcher
  5. Step 5: Verify paths before removing old copies
  6. Alternatives
  7. Common questions

If Android emulator files still fill your Mac after moving the SDK, move the AVD data separately and check its registration and launcher paths.

I use Android emulators and SDK on an external NVMe on my Mac mini.

Before starting, connect the SSD, stop every emulator, and make room for the device files and a separate backup. Record the current paths so you can undo the changes.

Step 1: Separate SDK and AVD storage

  • SDK location: SDK tools and installed system images. ANDROID_HOME points to this directory.
  • AVD home: files specific to virtual devices, including large disk images. ANDROID_AVD_HOME selects this directory.

These are separate settings. Changing the SDK location does not move existing AVD files. Android environment variables

The emulator uses shared system images from the SDK and writable images in each device’s data directory. On macOS, the usual device directory is $HOME/.android/avd/<name>.avd/. Emulator directories and files

Use a layout such as /Volumes/AndroidSSD/Android/avd for external AVD storage. Replace AndroidSSD with your SSD’s actual volume name.

Diagram: the SDK location and AVD home are separate settings; moving the SDK leaves virtual-device data behind.
The SDK and the AVD home are separate settings, so moving the SDK leaves device data behind

Step 2: Find the current files and check the SSD

In Android Studio’s Device Manager, open the device’s menu and choose Show on Disk. Record the locations of its INI registration file and .avd directory before changing any settings. Device Manager also provides Stop for running devices. Manage virtual devices

Check the SSD’s mount point and available space:

diskutil info "/Volumes/AndroidSSD"
df -h "/Volumes/AndroidSSD"

Confirm that the output identifies the intended external volume. A folder with the expected name is not enough. If the volume has mounted under another name, correct the paths before continuing.

Check that your account can write to the volume. Avoid creating the destination under /Volumes while the SSD is absent.

For the commands below, ANDROID_HOME must already point to your installed SDK. Keep its existing location when moving only AVD data.

Step 3: Back up and move one virtual device

Stop the emulator and quit Android Studio. Copy the device’s .avd directory and matching .ini file to a separate backup location. Keep their original names and record their original paths.

Inspect the backup for the configuration and disk-image files. Move one device first so that a path error is easier to isolate.

Android documents avdmanager move avd with an absolute destination path. The tool is deprecated, but its documentation still lists this operation for installations that include it. Android recommends Android CLI for new device creation. avdmanager documentation

Replace Example_Device with your device’s name. Set original_avd_home to the registration directory found in Step 2. Adjust latest if your installed command-line tools use a versioned directory.

(
  original_avd_home="$HOME/.android/avd"
  target_avd_home="/Volumes/AndroidSSD/Android/avd"
  avd_name="Example_Device"

  test -d "/Volumes/AndroidSSD" || exit 1
  test -w "/Volumes/AndroidSSD" || exit 1
  test -n "$ANDROID_HOME" || exit 1
  test -x "$ANDROID_HOME/cmdline-tools/latest/bin/avdmanager" || exit 1

  mkdir -p "$target_avd_home" || exit 1
  test ! -e "$target_avd_home/$avd_name.avd" || exit 1

  ANDROID_AVD_HOME="$original_avd_home" \
    "$ANDROID_HOME/cmdline-tools/latest/bin/avdmanager" \
    move avd -n "$avd_name" \
    -p "$target_avd_home/$avd_name.avd"
)

Complete the mount check in Step 2 before running these commands; the directory checks alone do not prove the SSD is mounted.

Stop if the command fails or the tool is missing. Do not overwrite an existing destination.

Inspect the resulting .ini registration and its path entry. Confirm that it names the external .avd directory. Keep the backup while checking the launcher settings.

Step 4: Set the AVD home for the launcher

Choose where to keep the device’s registration.

For one moved device, you can keep the updated .ini file in the original AVD home. Check that its path entry points to the external content directory.

To use the external directory as the AVD home, copy the updated registration into that directory. Check for an existing registration before copying. Avoid replacing it without inspecting both files.

For a terminal session, set:

export ANDROID_AVD_HOME="/Volumes/AndroidSSD/Android/avd"

Android documents this search order for emulator -avd:

  1. $ANDROID_AVD_HOME
  2. $ANDROID_USER_HOME/avd/
  3. $HOME/.android/avd/

Check all applicable locations for duplicate registrations. AVD environment settings

Apply the variable in the terminal session used for the emulator commands below. For repeated terminal use, add it to the startup file used by your shell. Android environment-variable setup

In Android Studio, use Show on Disk to inspect the registration and content directory it selects. Check this separately from the terminal command.

Step 5: Verify paths before removing old copies

From the configured terminal, list available devices:

"$ANDROID_HOME/emulator/emulator" -list-avds

Replace the device name and inspect the startup output:

"$ANDROID_HOME/emulator/emulator" \
  -avd "Example_Device" \
  -verbose

The -verbose option reports the files and settings selected during startup. Check the writable-image paths against your external directory and the system-image path against your SDK. Emulator command-line options

Before deleting old content:

  • Attempt a startup and inspect any errors.
  • If startup completes, inspect the apps and data you need to retain.
  • If you use Android Studio, inspect its Show on Disk location separately.
  • Shut down the emulator before comparing or changing its files.

Keep the backup if any check fails. Remove redundant registrations only after deciding which location your launcher should use. Check exact paths before deleting leftover internal copies.

Avoid Wipe Data during migration. It resets user data. Emulator disk images

For rollback, stop the emulator and quit Studio. Put the backed-up directory and matching registration at their original paths. Restore the previous AVD-home setting, then repeat the path and startup checks.

Alternatives

Option Main benefit Main tradeoff
External SSD AVD storage Places virtual-device data outside the internal disk Requires the SSD at the configured path
Internal AVD storage Keeps device files on the Mac Uses internal capacity
Fewer virtual devices Reduces the files you need to keep Narrows available device configurations
Physical Android devices Avoids AVD storage for tests run on that hardware Requires devices for the configurations you need

Common questions

Why is my internal disk still full after moving the Android SDK?

Existing AVD files can remain in their original location. Use Device Manager’s Show on Disk and check AVD-home settings separately from the SDK path.

Does setting ANDROID_AVD_HOME move existing devices?

No. It selects an AVD storage and search location. Moving existing content requires a separate operation, such as the documented avdmanager move avd command.

Why does Android Studio still show the old AVD location?

Check the registration selected by Show on Disk and inspect the fallback AVD directories for older registrations. Verify the AVD-home setting used by the launcher.

Can I unplug the SSD while an emulator is running?

Keep it connected while the emulator uses its writable images. Shut down the emulator and quit Studio before ejecting the volume.

Should I recreate the AVD or move the existing one?

Create a fresh AVD under the new storage setting when you can reinstall its apps. If you need the existing writable device state, keep a backup and use the documented avdmanager move avd command. Check the result before deleting the original. avdmanager commands

Does moving AVD storage also move Gradle caches?

No. Gradle documents its own user home, normally $HOME/.gradle, with GRADLE_USER_HOME as its override. It also keeps caches inside project directories. Inspect those locations separately. Gradle directories and caches

Related: Mac guides · full guide index.

../mac/ every Mac guide