I have 4 years developing in Xamarin and I really love it, but one of the things that can sometimes drive me crazy is when my Mac runs out of memory. I have a MacBook Pro with 256 hardDisk, so as you can see I don’t have a lot of space to waste.
In this article, I will show you how to clean out your computer a little bit and get some free space.
1- Delete iOS Simulators Data (On Mac)
Each time you run an app in an iOS simulator, the application data will be saved in a folder.
For cleaning it go to ~/Library/Developer/CoreSimulator/Devices, and delete all the files in this folder.
Instead of doing that, another option you could do is go to each one of the simulators used and do click on “Reset content and settings”
2-Delete the packages of the projects you are not using
When updating packages you should realize you will still have that previous package binaries on your solution packages folder. So keep in mind deleting those unused packages when running out of space.
As you can see here, in my package folder I have 2 versions of Xamarin Forms because I had updated it.
For example, this is the size of the package folder of one of my projects. Imagine if I have 10 projects with that many packages and always want to have it up to date.
For that just go to your project, select the folder “Packages” and delete it completely or just delete the duplicate version folders.
3-Delete the Archives generated that you don’t need
Every time you create an archive of a new installable release version of your application. This is being stored on the path, will recommend always deleting the ones you don’t need anymore.
You can access to these Roots going to:
iOS Archives: ~/Library/Developer/Xcode/Archives
Android Archives: ~/Library/Developer/Xamarin/Archives
And delete the content inside these two folders
In case you are using Windows, you can use the Root C:\Users\MyUser\AppData\Local\Xamarin\Mono for Android\Archives
When deleting archives consider just deleting the ones you don’t need any more in case you want to keep previously archived versions.
4-Clean bin & obj folders of your projects
When you build you project binary files are being generated each time. Is also good to delete those files on bin and obj folders to save some space.
To do that go to your Project Folder and delete each Bin/Obj folders for each one of your solution projects
If you don’t want to go to each folder to delete them, there are easier ways to do it:
1-Installing the Redth’s Adins
2-Via OSX Finder
3-Using the Terminal
5-Delete Cached build
Another place to look at is ~/Library/Caches/Xamarin/mtbs. When building, it can store cached builds here that you might not need after deploying and running your application.
If you are using Genymotion, there are two ways to clean space:
To clear cache go to Settings/Do click on “Misc” / Click on “Clear Cache”
2-Fully Simulator delete
When you delete an emulator using the delete button it doesn’t delete everything. If you want to delete completely open “VirtualBox”, and check all the devices that say “Inaccessible”, select them and click on remove.
Happy cleaning! 🙂