It's quite simple: Gather a sufficient amount of iron (4 million times earth's mass will probably do). Bring it all in one place, it will naturally compact. Wait for the resulting supernova - you do want to keep your distance for this step. Lastly collect gold and other heavy elements.
Exactly right. And to think there are still simpletons who dig in the ground for gold like neolithic primitives. Of course the doubters don't want us to know about this simple trick for turning iron into gold.