There is one thing (thank you @kos):

I definitely wouldn't remove gcc in general, but if I had to I wouldn't do it this way: this will remove also build-essential and hence make; for one, if you have the nVidia > drivers installed it will remove those as well, since they depend on make, plus who knows what other stuff.

With other words, know what you do. ;-)


If you only need a reinstall, use

sudo apt-get install --reinstall gcc-4.9

If you really, really need to remove gcc-4.9, use this short and dangerous command:

sudo apt-get purge gcc-4.9
Answer from A.B. on askubuntu.com
🌐
YouTube
youtube.com › watch
How to install test and remove gcc on ubuntu 18.04 (bionic beaver) - YouTube
Here, we are installed gcc 7.03 using apt-get method.
Published   August 14, 2018
🌐
LinuxQuestions.org
linuxquestions.org › questions › linux-newbie-8 › how-to-uninstall-gcc-so-i-can-start-over-4175603002
How to uninstall gcc so I can start over?
Linux - Newbie - This Linux forum is for members that are new to Linux. Just starting out and have a question? If it is not in the man pages or the
🌐
Install Lion
installlion.com › home › installion: how to uninstall gcc-5 on ubuntu 16.04 lts
Installion: How To Uninstall gcc-5 On Ubuntu 16.04 LTS
September 4, 2019 - http://installion.co.uk/ubuntu/xenial/main/g/gcc-5/uninstall/index.htmlGNU C compilerUbuntu 16.04 LTSdevel5.3.1-14ubuntu2 · sudo apt-get remove gcc-5 · This will remove just the gcc-5 package itself. sudo apt-get remove --auto-remove gcc-5 · This will remove the gcc-5 package and any other ...
🌐
Shorttutorials
shorttutorials.com › apt-get-commands › remove-gcc.html
apt-get remove gcc | How to Uninstall gcc in Linux with apt- ...
Here is the tutorial to learn how to uninstall gcc with apt-get command. Step 1: Open a terminal with 'su' access and enter the command as shown below. apt-get remove gcc -y Step 2: The command reads the package lists and proceeds with the uninstallation.
Find elsewhere
🌐
YouTube
youtube.com › roel van de paar
Ubuntu: Remove gcc from Ubuntu (2 Solutions!!) - YouTube
Ubuntu: Remove gcc from Ubuntu (2 Solutions!)Helpful? Please support me on Patreon: https://www.patreon.com/roelvandepaarWith thanks & praise to God, and wi...
Published   October 21, 2019
Views   353
🌐
DEV Community
dev.to › nullity › zai-ubuntu-2004-an-zhuang-gcc-13-1kd1
Install or uninstall gcc 13 on Ubuntu 20.04 - DEV Community
March 22, 2024 - sudo update-alternatives --remove gcc /usr/bin/gcc-13 sudo apt purge gcc-13 g++-13 · How to Install GCC Compiler on Ubuntu · How to Install GCC (build-essential) on Ubuntu 20.04 · The update-alternatives Command in Linux · Subscribe · For ...
🌐
TheLinuxFAQ
thelinuxfaq.com › ubuntu › ubuntu-17-04-zesty-zapus › gcc
How to uninstall or remove gcc software package ...
You can uninstall or removes an installed gcc package itself from Ubuntu 17.04 (Zesty Zapus) through the terminal,
🌐
Super User
superuser.com › questions › 663788 › uninstall-gcc-from-source
linux - Uninstall gcc from source - Super User
Although there is no top-level uninstall target, some directories do have it, in particular gcc, so you can do: ... This does not remove everything that was installed, but it removes major executables like gcc, g++, cpp...
🌐
Brainly
brainly.com › computers and technology › high school › how to downgrade gcc version in ubuntu.
[FREE] How to downgrade GCC version in Ubuntu. - brainly.com
To downgrade the gcc version in Ubuntu, first remove the current version with 'sudo apt-get remove gcc', then install the desired version using 'sudo apt-get install gcc-x.x', replacing 'x.x' with the version number.
🌐
Server Fault
serverfault.com › questions › 972076 › apt-remove-gcc-5-dependency-errors
ubuntu 16.04 - apt remove gcc-5 dependency errors - Server Fault
June 19, 2019 - I'm face on some troubles here. I'm trying to remove gcc-5, however there are a lot of dependencies that will be affect by it. I'm looking for a magician that could help me uninstall it without mak...
🌐
Ask Ubuntu
askubuntu.com › questions › 101471 › how-to-uninstall-gcc-4-6-2-installed-from-source
How to uninstall gcc 4.6.2 installed from source? - Ask Ubuntu
June 10, 2015 - Although there is no top-level uninstall target, some directories do have it, in particular gcc, so you can do: ... This does not remove everything that was installed, but it removes major executables like gcc, g++, cpp...
Top answer
1 of 3
1

Indeed, there is no "uninstall" command when installing from source, unless the developer has decided to put one in. (i.e., it's not impossible for a developer to create a script that undoes everything)

Your only option is to go into /usr/local/bin/ and remove each file yourself. But which ones to remove?

One solution is to reinstall 5.4, but specify a new directory that isn't /usr/local/bin/. This will give you a list of files that 5.4 installed. Then, using the list of files, go into /usr/local/bin/ and remove them manually. Note that it probably installed libraries and documentation into other directories, so to remove it completely, you will have to do more than just /usr/local/bin/.

An alternative is to not do an uninstallation and just install gcc 4-8 on top of 5.4. It's the same program, but just a different version. So gcc version 4.8 will overwrite 5.4. The "downside" is that you might have 5.4 files lying around, but they will just occupy (relatively little) space. It'll solve your problem and you can move ahead with what you want to do.

Of the two options, I'd pick the second one. The 5.4 files that remain won't affect your system. Relative to images, video, or almost any type of data, the space they occupy is fairly little (i.e., compiler, libraries, documentation is probably small). In the future, you should install it in another directory and add symbolic links manually. update-alternatives would do that for you if it's a package installed compiler; but for a compiler installed from source, that isn't an option.

(Aside: Ubuntu 14.04 has reached end of life, I think. You might consider upgrading some day... If so, then what /usr/local/bin/ looks like won't matter anymore!)

2 of 3
0

Just create a symbolic link to gcc-4.8

cd /usr/bin
sudo rm gcc
sudo ln -s gcc-4.8 gcc

now try

gcc --version

And see if you got the desired result

🌐
GitHub
github.com › Homebrew › homebrew-core › issues › 110010
Remove Linux-only GCC dependencies · Issue #110010 · Homebrew/homebrew-core
September 8, 2022 - help wantedTask(s) needing PRs from the community or maintainersTask(s) needing PRs from the community or maintainersoutdatedPR was locked due to agePR was locked due to age ... Now that we have migrated to a newer GCC in CI, we should no longer need any Linux-only dependencies on GCC due to needing to support newer C++ standards. We should discuss the best strategy for doing this that avoids breaking existing or new installations. Simply removing the depend_on "gcc" line shouldn't cause any problems for existing installations because we always add the RPATH for brewed GCC when pouring bottles.
Author   Homebrew
🌐
Quora
quora.com › How-do-I-downgrade-gcc-in-ubuntu-14-04-4-8-4-to-4-7-*
How to downgrade gcc in ubuntu 14.04 ( 4.8.4 to 4.7.*) - Quora
Answer (1 of 3): You can just remove the gcc version 4.8.4 by using apt-get remove gcc-4.8.4(package name) & install 4.7.* by using apt-get install gcc-4.7.*(package name) Also you can use both of them simultaneously.