Because they have a complex life cycle, raising fireflies is very difficult. To get from egg to adult, you will need to work out conditions that promote survival not just for the eggs, but also the larval and pupal stages. So far, scientists have been able to successfully rear just a few Asian firefly species (Luciola cruciata, Aquatica lateralis, and Aquatica ficta), all with aquatic larval stages.
Many people (including myself, Jim Lloyd, Lynn Faust and Larry Buschman) have tried to raise U.S. fireflies – all of which have terrestrial larvae – but without much success. If you find a mated female, it’s generally easy to get her to lay her eggs on moss. With luck, within a few weeks the eggs will successfully hatch out into tiny larvae. They’re cute and hungry! But the next step is extremely difficult: getting these larvae to eat, grow, and survive for the many months it takes before they’re big enough to pupate.
Although I’ve tried several different species, I’ve never gotten any of these terrestrial larvae to survive longer than 2-3 months. I’ve tried feeding them earthworms, snails, cat food (both wet and dry), and never gotten survival rates above 1%. So, as I recommend in Silent Sparks: Stepping Out, the best thing is to return any newly-hatched firefly larvae to their original habitat, where they’ll likely have a better chance of survival.

At 6 weeks, only 1% of these Ellychnia larvae still survived.
If you’re still determined to give it a try, Terry Lynch’s Firefly Notebooks provide a lot of useful information; Terry also describes his techniques for rearing Photinus larvae here.
Update April 2017: Exciting news – Dr. Scott Smedley at Trinity College, Hartford CT has successfully raised Pyractomena borealis fireflies for two generations! Stay tuned for more details about the rearing techniques he & his students have developed.