I've been working with Greg Frost's gear generator. Getting the gears to mesh requires some math, or trial and error. As a programmer, I don't like doing either one more than once. :-)
This script lets you specify the axle spacing and gear ratio and get the circular_pitch parameter. It simplifies fitting gears together.
This is a library. To use it, include it in your own OpenSCAD creation. There are two functions you'll need. The included example_gears module demonstrates their use.
gear_outer_radius lets you compute the meshing radius of a gear, given its parameters. You'll need this to translate the gears into position.
fit_spur_gears computes the circular pitch for Greg's script.