The first documented use of gold by humans was found in the jewelery recovered from the Varna Necropolis in Bulgaria and dated to about 6,500 years ago. Since then, enough gold has been mined from Earth's crust to form a cube 60 feet on a side.
Gold is one of the 100-odd basic elements in the universe. Number 79 in the element list, a cubic meter of it weighs 19 metric tons. Your 'weight in gold' would be worth over $2 million!
How much gold is there?
The most common ingredient to Earth's crust is silicon. It makes up beach sand, granite, sandstone and the actually the entire lithosphere. By comparison, you have to sift through about 250 metric tons of this stuff to come up with a measly 1 gram (5 carats) of gold. This kind of a gold mine would be rated at 0.004 g/ton. Generally, industrial mining is only economically feasible if the rating is about 1gram/ton or higher! The best mines produce gold at ratios of 5 gm/ton or more when a rich ore vein is available.
How about sea water? For every 250 million liters of water you will get about 1 gram of gold. This works out to about 1 gram for every 255,000 tons of water or a ratio of 0.000004 g/ton. This of course will be mixed with all kinds of other sediments in solution too, like 34,000 g/ton of sodium, chloride and other ions. So mining for gold in the ocean is not just a matter of evaporating away the water!
Across the universe, gold is pretty rare. For the sun, the largest reservoir of matter (mostly hydrogen) in our solar system, we can detect the light from gold atoms and figure out their abundance. The answer is that, for every trillion atoms of hydrogen, you get about 10 atoms of gold. So this works out to 4 trillion trillion grams of gold in the entire sun, or a miner's ratio of 0.002 g/ton. That's even worse than what you find in Earth's crust, but instead of mining granite and silicates, you would have to sift through million-degree hydrogen plasma!
Ok. How about the moon? Astronauts brought back hundreds of pounds of rock from the lunar surface that were carefully analyzed (trust me on this). The Apollo 11 rock samples had about 0.04 parts per billion of gold atoms, in rocks that were mostly like Earth crust. This works out to about 0.0003 g/ton. That's worse than the sun but not as bad a sea water! The recovery cost of 840 pounds of moon rocks by the Apollo program was about $250,000 per gram. Gold is worth only $39/gram.
Asteroids then? Instead of going out to space to mine them, we can wait for meteorites to (safely!) land on Earth and then mine them here. There are two major types: stony and irons. Stony meteorites are mostly made of silicate materials like Earth's crust, with silicon atoms at about at 180,000 ppm and gold at 0.2 ppm. One ton of stony material gives you about 0.35 g/ton of gold. This is not bad at all, but still not something that you would want to mine and hope to make much money at, even if the material were sitting smack in your backyard. The second class of meteorites is more interesting.
For iron meteorites, iron atoms are about 910,000 ppm and gold atoms are about 1.8 ppm. From one ton of mined iron meteorite you would expect to retrieve 7 grams of gold for a miner's ratio of 7 gm/ton. This sounds very profitable, but most mining operations crush quartz and silicates to retrieve their gold, which is lot easier than teasing it out of solid iron. To extract gold mixed with solid iron would be a huge problem and probably not economically worth the effort even at 50 grams/ton.
So the bottom line is that there really is no place like home...especially if there is a gold vein running through it!
Differentiation and settling
Because gold does not alloy with any other element and is always found in its pure state, this leads us to a difficult existential problem.
Through radioactive heating, our Earth became hot enough to have differentiated so that the very heavy iron and nickel elements as well as uranium and lead sank towards the center of our molten planet. The lighter silicates floated to the top to form the crust and lithosphere. Gold is a so-called iron-loving or "siderophile" element with a strong chemical affinity for iron. That means gold should have followed iron into the core of Earth....but here it is in the crust anyway. The question isn't, 'Why is there so much gold in the crust?' it's actually, "Why is there any at all?"
The world isn't perfect.
One possibility is that what we see today is just an impurity from the left-over of an imperfect process. 28% of Earth's mass is in its iron/nickel core. If this core has the same gold content as an iron meteorite (1.8 ppm of gold atoms versus 910000 ppm of iron atoms) then the total gold mass is about 11 billion billion kilograms. This would produce a solid gold sphere with a diameter of about 60 miles! To leave behind in the crust what should have sank into the core, we only need to leave 0.0001% of the original gold behind! That doesn't seem like a lot to ask from a messy and imperfect universe.
Gold: The late-comer
A second possibility is that the gold we see today, just like the water in our oceans, was brought here by a separate set of events that happened long after the planet differentiated and the crust formed. The most likely time for this was during the Late Bombardment Era, which ended around 3.8 billion years ago. The moon had formed 4.4 billion years ago and by that time the cooling Earth had almost fully differentiated into a crust/core system. The earliest traces of a solid crust, thanks to the discovery of zircon crystals, dates from about 4.3 billion years ago. So between 4.3 and 3.8 billion years ago, Earth was pummeled by asteroid debris, but not to the point that it re-liquefied the whole planet all over again. The asteroids left their debris in the form of our oceans and enhanced elements such as iridium, carbon....and possibly gold too.
The origin of gold.
An even bigger question is where does gold come from in the first place? Not from the Big Bang, but probably not entirely from supernova either. They really don't seem to get hot enough and last long enough to cook elements to things as heavy as gold in large enough quantities. One exciting new possibility is neutron star collisions!
Edo Berger of the Harvard-Smithsonian Center for Astrophysics and his team studied the gamma-ray burst event GRB 130603B located 3.9 billion light years away and deduced that it ejected a vast cloud of heavy elements. They estimated that about 10 times the mass of our entire moon in gold could have been produced in this one event. By also figuring out how common these events are across the universe (about one every few days), they claim that all of the gold in the universe could have been produced this way!
So there you have it. We all love gold, but the best and fastest way to get more of it is by doing what we have been doing for thousands of years. Learn geology, get lucky, and hope for a gold vein!