This is The Knife of Never Letting Go (2008) by Patrick Ness. It's the first book in the Chaos Walking series.
Todd Hewitt is the only boy in a town of men. Ever since the settlers were infected with the Noise germ, Todd can hear everything the men think, and they hear everything he thinks. Todd is just a month away from becoming a man, but in the midst of the cacophony, he knows that the town is hiding something from him -- something so awful Todd is forced to flee with only his dog, whose simple, loyal voice he hears too. With hostile men from the town in pursuit, the two stumble upon a strange and eerily silent creature: a girl. Who is she? Why wasn't she killed by the germ like all the females on New World? Propelled by Todd's gritty narration, readers are in for a white-knuckle journey in which a boy on the cusp of manhood must unlearn everything he knows in order to figure out who he truly is.

According to the Wikipedia page, the protagonist, Todd, grew up in Prentisstown, a male-only settlement on a colony planet.
Todd Hewitt is the only boy left in Prentisstown, a small settlement on New World – an alien planet only recently colonized by humanity. Todd is within days of his thirteenth birthday, the age in Prentisstown at which all boys become men.
Todd is told that all the women on the planet and most of the men were killed during a war between the human settlers and indigenous aliens known as the Spackle. The Spackle supposedly released a germ that was particularly fatal to women, and as a side-effect, caused all the surviving men to develop a form of telepathy that forces them to hear one another's thoughts all the time; they refer to this constant psychic chatter as the Noise.
Todd has been told that all the women and nearly all the men on New World were killed in a war with the Spackle that occurred around the time of his birth. The Spackle are New World's native inhabitants and are blamed for the release of a germ that caused the majority of deaths and was particularly fatal to women. The inhabitants of Prentisstown claim that every Spackle was wiped out during the war, and Todd has no reason to believe otherwise. As a side effect of the virus, the remaining men in Prentisstown can hear each others' (and animals') thoughts, described as an ever-present cascade of what they call Noise.
Shortly before his thirteenth birthday, Todd is told to flee Prentisstown by his adoptive parents, Ben and Cillian, who've been planning his escape for years. He's given some supplies and leaves with his dog, Manchee.
At the beginning of the book, Todd and his dog, Manchee, discover a lone patch of silence, described as a "hole in the Noise", in a local swamp. When Todd explains the silence to his adoptive parents, Ben and Cillian, his Noise accidentally projects the discovery to the entire town. Ben and Cillian suddenly reveal they have been planning Todd's escape from Prentisstown for his entire life. The two men immediately force him to leave Prentisstown with just a satchel of supplies and Manchee to accompany him. Todd unwillingly obeys. Cillian fights off the Mayor's son, Davy Prentiss, and other men from the town while Ben gives Todd his own hunting knife and Todd's deceased mother's diary.
Todd subsequently encounters a girl named Viola, who recently arrived on the planet in a scout ship sent ahead of another wave of human colonists (she was travelling with her parents, who were killed when the ship crash-landed). The pair are pursued by men from Prentisstown -- including the town preacher, Aaron -- but manage to elude them, and plan to head to another settlement where Todd hopes they'll be safe.
Todd escapes into the swamp with Manchee and discovers a girl who lacks Noise. She is the first girl Todd has ever seen, except in videos and photographs. The girl says nothing at all.
Todd, Manchee, and the girl are suddenly attacked by the town preacher, Aaron, who has recently been provoking Todd in physical and mental fights. Todd and Manchee force him into the swamp's lake, where he is attacked by crocodiles. The girl silently leads Todd through the swamp to her scout ship, where her parents' bodies lie dead. She has crash-landed on New World, Todd realises. With aid from a map inside Todd's mother's diary, the three begin traveling together towards Farbranch, a settlement marked on the map. Todd hopes that the settlement still exists and that, if so, it can protect them from Prentisstown.
Along the way, Todd realises that since he's still infected with the germ, he could inadvertently transmit it to Viola, thereby killing her. However, a woman from another settlement explains that the germ isn't fatal to women and doesn't affect them at all. That woman's settlement is subsequently attacked by men from Prentisstown.
Todd realises that he, infected with the germ, might transmit the germ to the girl and kill her. She hears this in his Noise and flees, but he pursues her, along with Manchee, until they both encounter Aaron and Prentisstown men who are tracking them at a bridge. The girl manages to save the three by soaking part of the bridge in lighter fluid and setting it on fire with her campfire pack. After this incident, she works up the courage to speak and finally tells Todd her name: Viola.
Todd and Viola are found by a woman from Farbranch named Hildy. She tells Todd that the Noise germ is, in fact, not fatal for women and does not affect them at all – none of the women have Noise. She takes the three to her settlement. At nightfall, an army of men from Prentisstown arrives and burns down the town, killing all those who will not join them. Todd, Viola, and Manchee escape and flee for Haven, where it is rumoured there may be a cure for Noise. They also hope to find a transmitter tower to contact Viola's people, who are a second wave of planetary settlers, to warn them.
It later transpires that the germ is a natural contagion of the planet -- rather than a biological weapon deployed by the Spackle -- and that since it only affects males, only men therefore gained telepathy from it and became subject to the Noise. The men of Prentisstown were driven mad by the Noise and murdered all their women.
After gaining some distance, Ben explains the truth: the Noise germ is a natural contagion of the planet, not an attack by the Spackle. The men of Prentisstown, driven mad by Noise and, resenting the women's ability to remain silent, killed all the women and were subsequently banished from the rest of New World for their crimes. The boys were supposed to learn a "version of the truth" from the Mayor on their thirteenth birthday, which is why Ben had sent Todd away; he could be accepted by the rest of the world only if his thoughts were wholly innocent.