Store rosemary and other herbs and spices in an airtight container away from heat and light. (Spices are best kept at room temperature.) Don't store it in a plastic bag or an area that's easily exposed to moisture. On average, you can keep whole sprigs of Rosemary fresh in your pantry for four to six months. Ground rosemary lasts three to four months when stored properly. If you notice mold developing on either form of Rosemary, discard it immediately.