Running out of space using Xamarin

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

NOTE:
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

http://motzcod.es/post/120368961047/xamarin-studio-obliterate-output-paths-binobj

2-Via OSX Finder

http://www.joesauve.com/remove-obj-and-bin-folders-via-os-x-finder/

3-Using the Terminal

https://gist.github.com/alexsorokoletov/3aa685c0d731d8f8eea44fc6cf0f6872

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.

6-Genymotion 

If you are using Genymotion, there are two ways to clean space:
1-Clear Cache
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! 🙂

You may also like

5 Comments

  1. Nice article!

    Yes I find all the space the Xamarin needs is a challenge.

    Here is an easy way I use to reset the simulators. Put this into a terminal session and watch all the disk-space come back quickly!

    —————————————–
    instruments -s devices \
    | grep Simulator \
    | grep -o “[0-9A-F]\{8\}-[0-9A-F]\{4\}-[0-9A-F]\{4\}-[0-9A-F]\{4\}-[0-9A-F]\{12\}” \
    | while read -r line ; do
    echo “Reseting Simulator with UDID: $line”
    xcrun simctl erase $line
    done
    —————————————–

    Also, I use a Xamarin Add-in called “Redth’s Addins” to clean bin/obj files across all your projects with one click. James Montemagno did a good blog about it here – http://motzcod.es/post/120368961047/xamarin-studio-obliterate-output-paths-binobj

    Thanks for the great tips on packages and archives too!

    1. Great! 🙂 To clean bin/obj I used to use another one for Xamarin Studio but had not found one for Visual. Thanks! Will include your references in my article in case someone does not read your comment!

  2. Great post! Very helpful. I received the following error after deleting simulator data and attempting to manually launch the simulator app on my Mac. To get around it, I just ran my project and the simulator launched successfully, but I could have also just not deleted the ‘device_set.plist’ file.
    Unable to boot device because it cannot be located on disk

  3. Thanks! After some years of working with Xamarin i decided to remove everything and install from scratch – gave me some extra 150gb!