To unlock a gem, you need to collect all crates in a level. I will list every level and mention if they need a coloured gem to obtain the gem. Unlocking 13 gems in levels of your choice will unlock the trophy
then once you reach 26 gems, you will unlock this trophy.
For the normal gems, you can die and restart from a checkpoint to unlock it.
For a special coloured gem, you have to do the run without dying. You can die in a bonus stage and still get it, as long as you repeat the bonus stage and get all boxes.
All the levels that give a gem and any special information:
N. Sanity BeachJungle Rollers - This needs the Green Gem
The Great Gate - This needs the Gold Gem
BouldersUpstream - This needs the Yellow Gem
Rolling Stones - This needs the Blue Gem
Hog WildNative Fortress - This needs the Red Gem
Up The CreekThe Lost City - Green Special Gem unlock so you can't die except on bonus stages
Temple RuinsRoad to Nowhere - This needs the Red Gem
Boulder Dash - This needs the Purple Gem
Whole Hog - This is at a fork in the road from Boulder Dash, you need the key from Sunset Vista to access this level
Sunset VistaHeavy MachineryCortex Power - This needs the Blue Gem
Generator Room - Yellow Special Gem unlock so you can't die except on bonus stages
Toxic Waste - Blue Special Gem unlock so you can't die except on bonus stages
The High RoadSlippery Climb - Red Special Gem unlock so you can't die except on bonus stages
Lights Out - Purple Special Gem unlock so you can't die except on bonus stages. This one needs the Gold Gem
Fumbling in the Dark - This is at a fork in the road from Light Out, you need the key from Jaws of Darkness to access this level
Jaws of Darkness - This needs the Blue Gem
Castle MachineryThe Lab - Gold Special Gem unlock so you can't die except on bonus stages
If you plan to give a negative vote, then please tell me what is missing?