Did people just buy thing with the gold itself or did they have people that would actually buy it? Both seem difficult to manage either it would be hard to buy stuff with just the gold and if they sold it where did the buyers get the finance for that much gold?
In the wake of the discovery of gold in California in 1848 - and the subsequent Rush of '49 - The World Rushed In, as proclaimed by the title of the classic book on the period by J. S. Holliday (1981). With tens of thousands of newcomers and barely a sufficient infrastructure, there was a great deal of improvisation.
The young society that took shape relied a great deal of barter for goods and services. Much of this drew upon the ubiquitous gold that was flooding all communities: people became adept at weighing gold dust and nuggets and assessing a rough value for the commodity so it could be used in its raw form as a means of exchange.
In addition, various independent players and institutions began minting gold coins, so there would be currency available for this purpose. These could be used to buy gold dust from miners, and the dust would then be minted, completing the cycle.
The U.S. Mint opened in San Francisco in 1854, providing a more stable and agreed-upon currency, which quickly dominated the new state (and the adjacent territories).
The economy that quickly emerged in the 1849 Gold Rush included entrepreneurs, many of whom arrived with sufficient financial resources to become merchants or bankers. While it was possible for a miner to "make his pile" as getting rich was called at the time, the fastest and most reliable means to become rich at the time was to become a merchant or banker. A miner considered himself (or herself - there were a few women engaged in the Gold Rush) a success upon acquiring a pile that could provide a means to buy a farm with livestock back home or in the Midwest. Often $10k was the target amount. Bankers and merchants could expect to amass a fortune far exceeding this amount.
I co-edited a collection of letters from a pair of brothers who came to California in 1849 and died in 1857. Their account of struggling to survive and to "make their pile" (they never did), provides much of the insight I used for this answer: see my The Gold Rush Letters of E. Allen Grosh and Hosea B. Grosh (2012).
edit: I should also point out that J. S. Holliday (1924-2006) was perhaps the nicest historian I ever met. Without any motivation other than his generous instincts, he offered me a great deal of encouragement when I sought to publish my dissertation, which emerged in 1998 as The Roar and the Silence: A History of Virginia City and the Comstock Lode. When I told him I had written the book, he became so excited that he began pounding me on the shoulder telling me that this was something that was long overdue. He pounded down on my shoulder, which also said a great deal about his stature - at the time I stood 6'2" and he pounded DOWN onto my shoulder. He was a giant of a man, both physically, but also for his scholarship and kindness. I mourned his passing.