I say age 1 when you tell them in no uncertain terms that if they ever touch one without your approval you will beat their little asses into a greasy spot on the floor. Then when they are 5 get them a .22 rifle.
I had a slightly different approach with my son, mama. It seems to work so far. It's based on my experience when I was growing up, where my mom forbade guns of any kind - real, toy, make-believe, or imaginary - in her house. As a result, when I was a kid, EVERYTHING was a gun to me. I didn't have a gun - or any practical experience with said tools - until I turned 18, and had property that did not have my parents name on it (my car) to store it in.
So, knowing my son is going to be every bit as facinated with "forbidden fruit" as I was, I've gone to great lengths to ensure that he never sees firearms as that irresistable "forbidden fruit". I made a gun cabinet in my father-in-law's carpentry shop when we knew he was coming. Keyed lock, and only my wife and I have the key. 99% of my firearms are stored in that locker. When he was about 3 he started getting curious when I would clean guns after a session at the range. I'd let him look at and handle the parts as I was cleaning them (and - much to his mother's chagrin - while some were still filthy). As I said, I only keep most of my weapons in the cabinet: my XD stores in it's open, padded case in a drawer in my bedframe - right beneath my pillow. He knows that he's not permitted in mommy and daddy's bedroom without escort, but once he started getting observant about what was kept where, I escorted him through the drawer where the XD was kept. I showed him the difference between the pistol with the slide locked back and magazine dropped, and with the slide forward and a magazine in the well. I let him know that when he saw the pistol in the former condition - as in I had it out for some reason, all he had to do was ask, and I'd let him handle the pistol. If he ever came across the pistol in the latter condition, he was to run to mommy or daddy and tell them "The pistol has owies in it". Every so often, we leave it out where he can find it intentionally, in order to drill him on what he's supposed to do. If he finds it open and asks to handle it, we gave him a candy. If he found it closed with a mag in the well, and he told us that the pistol had owies in it, same thing. Sometimes, to make it harder on him we leave it where he can find it, with the slide locked back AND a mag in the well, and he responds correctly to that one too: "The pistol has owies in it".
Treating it in this manner means that he is developing the understanding that firearms are like any other appliance in the house, the stove, for example. He can walk by the stove without any particular fear of getting hurt by it, and no particular interest in playing around with it. Same thing for the firearms in the house. We have been living at a heightened state of alert since the incident a couple of weeks ago where the local PD came looking for my neighbor (still unresolved, though it looks like he's beating feet across the county line to reduce his chance for modelling orange jumpsuits and stainless steel bracelets in the near future), and my loaded pistol has moved up from the drawer to locked and loaded on my nightstand, with the shotgun standing locked and loaded in the closet. Every morning, my -now 5-years old - son comes upstairs and climbs into bed with me to cuddle in the early morning, and he doesn't give the pistol sitting right there within his reach a second thought.
He continues to come along this well, and he'll likely have a .22 by the time he's 8.