Prior to the California Gold Rush the Nisenan Maidu occupied both permanent villages and temporary summer shelters along the rivers and streams which miners sifted, sluiced, dredged and dammed to remove the gold. Explorer Jedediah Smith and a large party of American fur trappers crossed the Sacramento Valley in late April, 1827. The group saw many Maidu villages along the river banks. Deprived of traditional foodstuffs, homesites and hunting grounds by the emigrants, the Nisenan were among the earliest California Indian tribes to disappear.
During the 1850s, miners sluiced streams and rivers including Secret Ravine which runs through Rocklin. The piles of dredger tailings is still obvious today, between Roseville and Loomis southeast of Interstate 80. Secret Ravine at the area now at the intersection of Ruhkala Road and Pacific Street was later mined for granite, some of which was used as the base course of the California Capitol Building in Sacramento, although the earliest recorded use of the rock was for Fort Mason at San Francisco in 1855. The granite was hauled out by ox carts before the arrival of the railroad many years later.
In 1860, the U.S. Census counted 440 residents in the area of Secret Ravine, of which approximately 16% had been born in Ireland and the majority of whom worked as miners. The area was referred to as Secret Ravine or the “granite quarries at the end of the tracks” as late as 1864.
Rocklin’s history is closely tied to the transcontinental railroad. In 1862, the Pacific Railroad Act granted the Central Pacific Railroad land near Secret Ravine. In 1864, the Central Pacific Railroad completed an extension of its track southwest from Newcastle to Secret Ravine. It named the area Rocklin after its granite quarry, and used the site a refueling and water stop. The Central Pacific built a roundhouse in 1867. The transcontinental railroad was completed in 1869, significantly increasing railroad traffic through the town. According to the 1870 census, Rocklin had grown to 542 residents, and the majority of Irish immigrants had foregone mining and were working for the railroad. In 1906 the Central Pacific moved its facility from Rocklin to Roseville, where more land was available for expansion. The site in Roseville has remained in continuous use since. As of August 2014, it is the largest rail facility near the US West Coast.
In 1869 a group of laid-off Chinese railroad workers moved to Secret Ravine to mine and raise vegetables which they sold locally. They were driven out during the anti-Chinese pogrom of September 1876 but the area is still known as China Gardens.
The Rocklin post office opened in 1868. Finnish immigrants settled in Rocklin starting in the 1870s, and Spanish settlers arriving by way of Hawaii settled in Rocklin during the early 20th Century. The town incorporated in 1893.