The first step to dealing with an infestation of carpenter ants in the home is to locate the next. If the nest is inside the house, dust toxic to the ants such as boric acid can be puffed into small holes drilled into the walls. If the nest is outdoors in a stump or log, it can be sprayed with commercial insecticide.
The best way to find a carpenter ant nest is to bait the ants. Something sweet such as honey or jelly should be set out, and the ants will lead the observer from the food to the nest. Carpenter ants do not eat the wood they bore through, so the entrances to their nests typically have wood shavings, dead insects and other debris outside. Boric acid kills ants on contact. The amount needed is not harmful to humans or other mammals.
Carpenter ants prefer water-damaged wood. To prevent infestation, damp, decaying wood should be replaced with new dry wood, and roofs, gutters and downspouts should be properly maintained. Since carpenter ants travel into the house from branches and other protruding materials, shrubs, trees and other vegetation should be trimmed back away from the house. Openings for wires and cables should be caulked to prevent entry. Firewood should be stored well away from the home. Crawl spaces and spaces under wooden porches should have moisture barriers over the soil and be adequately ventilated.