Close the gate. Place a heavy object against the gate to prevent it from opening as you install the latch. Use a pencil to mark the gate at the height where you plan to install the latch. Tear off a piece of tape about 8 inches long. Place the tape horizontally across the gap between the gate and gatepost, so it extends a few of inches on either side of the gap at the level of your reference mark.
Test-fit the latch assembly and the catch on the gate, aligned to the tape. Use a pencil to trace around the mounting plate on the catch and mark the positions of the installation screw holes on the gatepost. Remove the latch and catch. Use a drill and drill bits to make pilot holes through the screw hole marks on the gatepost. Reposition the catch on the gatepost. With a drill and driving bit, screw the catch to the gatepost.
Position the latch assembly on the gate, aligned to the catch and tape. Mark the positions of the latch's screw holes on the gate. Remove the latch and drill pilot holes through each screw hole mark. Reposition the latch assembly, screw it to the gate and remove the tape.