How to completely remove Visual Studio from mac?

30,209

Solution 1

In case anyone else having the same question visited here, please visit the official guide.

The following is quoted from the original guide which was updated at 2017-4-14.

Uninstall Visual Studio for Mac App

Step 1. Locate Visual Studio.app in the /Applications directory and drag it to the Trash Can. Alternatively, right-click and select Move to Trash.

Step 2. Remove all traces of Visual Studio for Mac

Execute the following commands in your terminal:

sudo rm -rf "/Applications/Visual Studio.app"
rm -rf ~/Library/Caches/VisualStudio
rm -rf ~/Library/Preferences/VisualStudio
rm -rf "~/Library/Preferences/Visual Studio"
rm -rf ~/Library/Logs/VisualStudio
rm -rf ~/Library/VisualLodStudio

Uninstall Xamarin.Android

sudo rm -rf /Developer/MonoDroid
rm -rf ~/Library/MonoAndroid
sudo pkgutil --forget com.xamarin.android.pkg
sudo rm -rf /Library/Frameworks/Xamarin.Android.framework 

Uninstall Xamarin.iOS

rm -rf ~/Library/MonoTouch
sudo rm -rf /Library/Frameworks/Xamarin.iOS.framework
sudo rm -rf /Developer/MonoTouch
sudo pkgutil --forget com.xamarin.monotouch.pkg
sudo pkgutil --forget com.xamarin.xamarin-ios-build-host.pkg

Uninstall Xamarin.Mac

sudo rm -rf /Library/Frameworks/Xamarin.Mac.framework
rm -rf ~/Library/Xamarin.Mac

Uninstall Workbooks and Inspector

sudo /Library/Frameworks/Xamarin.Interactive.framework/Versions/Current/uninstall

Uninstall the Visual Studio Installer

rm -rf ~/Library/Caches/XamarinInstaller/
rm -rf ~/Library/Caches/VisualStudioInstaller/
rm -rf ~/Library/Logs/XamarinInstaller/
rm -rf ~/Library/Logs/VisualStudioInstaller/
rm -rf ~/Library/Preferences/Xamarin/
rm -rf "~/Library/Preferences/Visual Studio/"

Uninstall Mono SDK (MDK)

Warning

There are other applications outside of Xamarin which also use Mono, such as Unity. Be sure that there are no other dependencies on Mono before uninstalling it.

sudo rm -rf /Library/Frameworks/Mono.framework
sudo pkgutil --forget com.xamarin.mono-MDK.pkg

Other apps with name prefix Xamarin

The official guide didn't mention it, but I found there were other apps named Xamarin.xxxx in my library directory. I simply moved them to trash.

Solution 2

May be this would be better solution (no need to follow each step): https://raw.githubusercontent.com/MicrosoftDocs/visualstudio-docs/master/mac/resources/uninstall-vsmac.sh :

#!/bin/sh

# Uninstall Visual Studio for Mac
echo "Uninstalling Visual Studio for Mac..."

sudo rm -rf "/Applications/Visual Studio.app"
rm -rf ~/Library/Caches/VisualStudio
rm -rf ~/Library/Preferences/VisualStudio
rm -rf "~/Library/Preferences/Visual Studio"
rm -rf ~/Library/Logs/VisualStudio
rm -rf ~/Library/VisualStudio
rm -rf ~/Library/Preferences/Xamarin/
rm -rf ~/Library/Developer/Xamarin

# Uninstall Xamarin.Android
echo "Uninstalling Xamarin.Android..."

sudo rm -rf /Developer/MonoDroid
rm -rf ~/Library/MonoAndroid
sudo pkgutil --forget com.xamarin.android.pkg
sudo rm -rf /Library/Frameworks/Xamarin.Android.framework


# Uninstall Xamarin.iOS
echo "Uninstalling Xamarin.iOS..."

rm -rf ~/Library/MonoTouch
sudo rm -rf /Library/Frameworks/Xamarin.iOS.framework
sudo rm -rf /Developer/MonoTouch
sudo pkgutil --forget com.xamarin.monotouch.pkg
sudo pkgutil --forget com.xamarin.xamarin-ios-build-host.pkg


# Uninstall Xamarin.Mac
echo "Uninstalling Xamarin.Mac..."

sudo rm -rf /Library/Frameworks/Xamarin.Mac.framework
rm -rf ~/Library/Xamarin.Mac


# Uninstall Workbooks and Inspector
echo "Uninstalling Workbooks and Inspector..."

sudo /Library/Frameworks/Xamarin.Interactive.framework/Versions/Current/uninstall


# Uninstall the Visual Studio for Mac Installer
echo "Uninstalling the Visual Studio for Mac Installer..."

rm -rf ~/Library/Caches/XamarinInstaller/
rm -rf ~/Library/Caches/VisualStudioInstaller/
rm -rf ~/Library/Logs/XamarinInstaller/
rm -rf ~/Library/Logs/VisualStudioInstaller/

# Uninstall the Xamarin Profiler
echo "Uninstalling the Xamarin Profiler..."

sudo rm -rf "/Applications/Xamarin Profiler.app"

echo "Finished Uninstallation process."

If you haven't dealt with bash script before, you may look at its documentation too: https://docs.microsoft.com/en-us/visualstudio/mac/uninstall

Actually, it is pretty easy. Create a file with extension .sh (for example, vsremover.sh) and paste the code above. Save. Open terminal application, go to the place where you saved the file (for example: cd /Users/yourname/Desktop) and type the following:

chmod +x vsremover.sh

Then run it:

./vsremover.sh
Share:
30,209

Related videos on Youtube

Shrijan Aryal
Author by

Shrijan Aryal

Your day is productive when you realize that your phone's battery has only gone down by 3% in an entire day.

Updated on September 18, 2022

Comments

  • Shrijan Aryal
    Shrijan Aryal almost 2 years

    I recently installed Visual Studio for mac right after the day it was launched. It consumed 20 gb of my disc space, so I decided to remove it. I went in to the applications folder and moved recently installed components associated with the installation to the trash. But it did not free any space at all. So I searched online and followed the following link for uninstallation: Uninstalling Xamarin

    After following the link and entering all the terminal commands, I was only able to free up 10 gb of storage. How do I free up the rest 10 gb of the storage ?

  • lowatt
    lowatt about 7 years
    @DavidPostill♦ @Pierre.Vriens Added quotes.
  • DavidPostill
    DavidPostill about 7 years
    Much better. You need to block quote everything though. Please read How to reference material written by others. You must block quote text that has been written by some else. See Markdown help. I've fixed it for you this time, but please pay attention to this in future.
  • Dormouse
    Dormouse over 5 years
    Thanks for this! I also had ~/Library/Developer/Xamarin/ taking up 10+ GB.