Error of Gradle: No space left on device in macOS

Tiempo de lectura: 2 minutos

If you’re developing on React Native or Android on macOS and suddenly the build fails with a long Gradle error, it’s very likely that the problem is not your code.

Patos - pexels

This is one of the most common messages:

org.gradle.api.UncheckedIOException: java.io.IOException: No space left on device

Although it may seem like an internal error of Gradle, the real cause is much simpler: your disk is full..

In this tutorial I will explain:

The error usually appears during an Android build and points to paths such as:

android/.gradle/8.x/fileHashes/fileHashes.bin

or native libraries of the type:

librnscreens.so

This usually leads to thinking:

Nothing more than a mile away from reality.

In macOS, especially with APFS, it may happen that the system “seems” to have space, but the important partition is at the limit.

Check with:

df -h

If you see something like this:

/System/Volumes/Data 100%

The diagnosis is clear:

Xcode accumulates over time:

Each version of iOS can occupy between 6 and 10 GB, and they are not automatically deleted.

The typical routes are:

~/Library/Developer/CoreSimulator ~/Library/Developer/Xcode/DerivedData

Safe Cleaning (recommended)

This command removes outdated simulators safely:

xcrun simctl delete unavailable

For a full cleanup (recommended if you don’t use Xcode daily):

rm -rf ~/Library/Developer/CoreSimulator/*

Delete DerivedData from Xcode

Totally safe, Xcode regenerates it when needed:

rm -rf ~/Library/Developer/Xcode/DerivedData

Clean Android and React Native Environment

After releasing space, it’s convenient to clean up build caches:

rm -rf ~/.gradle/caches rm -rf android/.gradle rm -rf node_modules

Luego reinstala y limpia el proyecto:

npm install cd android ./gradlew clean

If you use Docker (very common)

Docker is another big silent disk consumer.

Use:

docker system df

And clean up everything that is not in use:

docker system prune -a

This can free up dozens of GB.

To work with Android and React Native on macOS:

The errors in the build will reappear with less space again.

If you see an error related to caching or disk writing from a Gradle:

In most cases, the issue is not Gradle, but rather macOS accumulating development trash.

Leave a Comment