I am trying to install G++ compiler in Ubuntu 13.10. It told me I needed to install the build-essential package.

I have tried the below code

sudo apt-get update
sudo apt-get install build-essential

It gives me this error:

Reading package lists... Done
Building dependency tree 
Reading state information... Done
E: Couldn't find package build-essential
  • 1
    did you find build essential package on synaptic and software-center? – Avinash Raj Jan 1 '14 at 12:59
  • what is build-essential good for? – sharkant Apr 29 '17 at 11:02
  • I encountered a similar problem. I solved it by entering 'sudo apt-get upgrade' after 'sudo apt-get update'. – Chong Lip Phang Oct 17 '18 at 8:44

Type in the Terminal sudo apt-get install build-essential and then press key TAB instead of pressing ENTER.

| improve this answer | |
  • 56
    Why does this solve the problem? – mafu Jan 14 '17 at 19:21
  • It helped me install ubuntu-restricted-extras .. thanks! – eigil Mar 11 '19 at 12:55
  • 2
    Did not work for me. Ubuntu 18.04.2 – leetbacoon Jul 15 '19 at 10:42
  • 1
    @mafu Because with the tab you actually enter ...essentials not ...essential. – thanos.a Jun 2 at 0:10
  • @thanos.a thanks – mafu Jun 2 at 21:39

Enable main repository in Software & Updates.

Then run these commands in a terminal:

sudo apt-get update
sudo apt-get install build-essential
| improve this answer | |

You have to enable the main repository in the /etc/apt/sources.list file.
To accomplish this remove the '#' character in front of the following lines.

#deb http://de.archive.ubuntu.com/ubuntu/ saucy-updates main restricted
#deb-src http://de.archive.ubuntu.com/ubuntu/ saucy-updates main multiverse restricted universe

Save the file and execute
sudo apt-get update && sudo apt-get install build-essential.

| improve this answer | |

You need to install the package build-essential for making the package and checkinstall for putting it into your package manager.

Use this command line:

sudo apt-get install build-essential checkinstall


| improve this answer | |

Well, sometimes what happens is that if your first command fails due to some repo not responding or other network issues

sudo apt-get update

Then you may not be able to install build-essential. So always ensure that apt-get update completes successfully. Once update is commpleted, issue:

sudo apt-get install build-essential

Now you should be able to install it successfully.

| improve this answer | |
  • He has declared in the question that he gets error for it. – Mostafa Ahangarha Mar 17 '16 at 14:27
  • That's the reason I said that if there's an error, you have to run apt-get update again, to ensure that all repo's do respond. Sometimes repos don't respond due to network problem as that's the reason why I had an issue. – Ketan Patel Apr 4 '16 at 8:13

You can also install build essentials from software center
Open it up, and search for "build essential"

| improve this answer | |

These terminal commands should solve your problem:

First remove the Merge List by opening a terminal (Press Ctrl+Alt+T to launch) and run this command:

sudo rm /var/lib/apt/lists/* -vf


sudo rm -vf /var/lib/apt/lists/*

these command lines are interchangable

the options used are -v verbose

-v, --verbose explain what is being done

and -f force

-f, --force ignore nonexistent files and arguments, never prompt

If you are ever unsure about a command line or the options being used always refer to the manual page for the command. These can be accessed on the internet by searching for man and the command for example man rm or you can access the same information by typing exactly the same command in the terminal for example man rm instructions for quitting the page will be at the bottom of the terminal like this

picture of man page options

Next, generate a new one by running a simple update:

sudo apt-get update

Then do,

sudo apt-get install build-essential
| improve this answer | |

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