I want to completely remove gcc from Ubuntu. I am using gcc 4.9 which happens to be the latest version.

How can I remove it completely from my system?

  • 3
    Can I ask you why ? You will need it eventually
    – rpax
    Jul 27, 2015 at 22:50
  • Probably trying to get nvidia drivers to work Nov 17, 2018 at 19:01

2 Answers 2


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
  • I just wanted to remove it and install it all over again. If I install it again will it be a problem still?
    – Noober
    Jul 27, 2015 at 15:39
  • 6
    yes. Use sudo apt-get install --reinstall gcc-4.9 instead
    – A.B.
    Jul 27, 2015 at 15:41
  • What makes it dangerous? Nov 17, 2018 at 19:00

use below command , --purge remove option is equivalent to purge

sudo apt-get --purge remove gcc-4.9

according apt-get manual:

   Use purge instead of remove for anything that would be removed. An
   asterisk ("*") will be displayed next to packages which are
   scheduled to be purged.  remove --purge is equivalent to the purge
   command. Configuration Item: APT::Get::Purge.
  • 1
    equivalents are always good =)
    – A.B.
    Jul 27, 2015 at 18:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.