How to Completely remove mono?
I've been trying to remove mono completely from my Ubuntu 12.04 installation.
I have seen a few other posts with:
sudo apt-get purge mono-runtime
sudo apt-get purge mono-complete
sudo apt-get purge libmono* libgdiplus cli-common libglitz-glx1 libglitz1
I've run all those and done sudo apt-get update
but when I type mono -V
it's still there.
I'm trying to remove it completely to re install again with the latest beta build Mono JIT compiler version 2.10.8 (tarball Wed Oct 2 16:46:11 CEST 2013)
Is the version I have currently but NEED the latest beta build.
Solution 1:
sudo apt remove --purge --auto-remove mono-runtime
This will then completely remove mono from your system to correct the issue.
Solution 2:
Ok simply run sudo rm -rf usr/lib/mono /usr/local/bin/mono /usr/local/etc/mono /usr/local/lib/mono
in terminal.
Solution 3:
This is how I did on my 16.04
Before someone starts raging and telling me there was a better, faster and more concise way to do that: Yes, I know. I took the "long way" to analyze the results of each step and triple check what I was doing.
- be su:
sudo -i
- list all the packages from the mono repository (into file pkg1):
grep ^Package: /var/lib/apt/lists/download.mono-project.com*_Packages > pkg1
- extract just the package names (into file pkg2):
sed -e 's/^.*Package: //' pkg1 > pkg2
- (optional but I wanted to do that anyway) remove duplicate package names from different architectures and put definitive list of packages to search for and remove in pkg3:
awk '!seen[$0]++' pkg2 > pkg3
- (optional, for check) count the lines in the files (one line = one package) to see what happened:
wc -l pkg1
andwc -l pkg2
andwc -l pkg3
- remove packages listed in pkg3:
apt purge $(cat pkg3)
- cleanup and exit su:
rm pkg1 pkg2 pkg3
andlogout