Free space in your Mac for Mobile Development
Tags: mobile, android, ios
Published: 2021-07-06 10:48:11

---
title: Free space in your Mac for Mobile Development
published: true
description: How to clear storage space in a Mac for Mobile Development
tags: mobile , android , ios 
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/17i3fge90ck643m6cyx1.jpg
---
Once every few months i perform the much needed relieving task of freeing disk space out of my 256GB Mac. I often use [CleanMyMac](https://macpaw.com/cleanmymac) is an ideal software for periodically cleaning out your disk space with some added performance and security optimisations. However when you wan't to clean out your dev environment it takes a few manual commands to get the job done since disk cleaner software won't know what to clear. You'd be surprised how much space you recover after clearing out unused dev resources. This article describes how to free storage space for Mobile Developement in a Mac laptop.

## Android

### 1. Clean up Gradle

Your Gradle Home directory contains wrapper ,caches and daemons files. The more projects with diffferent gradle versions the more subdirectories within those three folders. You can delete all three directories. This saved me a cool  **~12GB** of space.

You could run the command as below to achieve the desired result.

```bash
cd ~/.gradle
rm -rf caches daemon wrapper
```

### 2. Android SDK Cleaning

Android System images are only used by emulators. If you use a real Android device during development for debugging, you no longer need them, so you can remove them all. This could easily save you **5GB** doing this.

![Android Studio SDK Manager
](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d7g6ncwtkgcsaypiykn6.png)
_Android Studio SDK Manager_



## iOS

Its easy to run out of space while doing iOS Development since Xcode loves to cache things everywhere around your Mac. It gets even complicated once Xcode has an update(~11GB) but realistically its around ~40GB free space required to download and install the update.  Sadly i've had to delete Xcode and install it again to make it work again.

![Xcode Update](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2lxm2why28k7ht6ku6a1.jpeg)
_Xcode Update Space Error_🙃


### 1. Remove Old Simulators

As with Android the major culprit will be old simulators that take alot of space.  The simulator files are by default located in `~/Library/Developer/Xcode/iOS/Device Support` folder. You can delete old simulators using the following command.

```bash
xcrun simctl delete unavailable
```

### 2. Remove Cocoapod Caches

If you use Cocoapods in your projects you can clear them using this command. Don't worry you can rebuild them later again.

```bash
rm -rf "${HOME}/Library/Caches/CocoaPods"
```

### 3. Clean up Archives,Logs and DerivedData folders

Folders like DerivedData can take up a significant amount of space too. DerivedData is generated during each build process. This contains intermediate build results,indexes that speed up time on each build.  You can use the command below to clear all that data. 

 

```bash
rm -rf ~/Library/Developer/Xcode/Archives
rm -rf ~/Library/Developer/Xcode/DerivedData
rm -rf ~~/Library/Developer/Xcode/iOS Device Logs/
```

## DevCleaner for Mac

If you're not to keen in heading to this article again to clean up your iOS Development workspace, you can download this [DevCleaner](https://apps.apple.com/us/app/devcleaner/id1388020431?mt=12) by One Minute Games that handles it superbly.

![DevCleaner App UI](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zqulb75cxejz9mxbxk5i.png)
 

## Conclusion

Don't forget to empty your trash to check out how much space you have available. I was able to clear around **~15GB** after doing this. I hope this also works for you. You can recommend other tools or ways you've found that has freed space for mobile development. It would be cool to add it to the article.