Find the food source of the beetle infestation, seal it and remove it from your home. Pay special attention to packages you haven't used for a while, as well as damaged packages. If you find beetles or larvae in one package, they may be in others as well. Carefully check each bag and box of grains in your pantry, sealing and discarding those with beetles.
Freeze infested food for one week if you do not want to throw it away. Remove it from the freezer for at least three days before returning it to the freezer for another week. This kills the beetles and larvae, but the bodies remain in your food. Use a fine sieve to separate them from your grains.
Heat infested food instead of freezing it, if desired, to kill the beetles. Spread flour or other grain on cookie sheets in a thin layer and place the sheets in a warm oven (120 to 130 degrees Fahrenheit) for two hours, stirring the grain occasionally. Avoid scorching the grain by keeping the temperature well below 180 degrees Fahrenheit, which is the low setting on some ovens. If your oven doesn't go any lower, use the freezer method in Step 2.
Prevent spills from sitting too long by regularly wiping out your kitchen shelves, cupboards, bins and drawers with a wet rag. A vacuum cleaner with a hose attachment is another option for cleaning up. This helps prevent new beetles from taking up residence in your grain packages.
Keep your grains and flours in airtight containers, and wash out old containers before filling them with new grains. Store items you don't use very often, like pancake mixes, grains and spices, in the freezer to prevent the possibility of future infestation.