Somehow James Sr. was able to take advantage of economic opportunities that presented themselves in that region and he was somehow able to buy a trading post in Cove Gap. His uncle was a wealthy tavern owner and farmer and James Sr. learned of a location in Cove Gap known as Stoney Batter (batter is a Gaelic word meaning road). James Sr. worked as an apprentice at that trading post. He married Elizabeth Speer in 1788 and in 1791 he was able to buy the trading post, probably assisted by the fact that his bride was the daughter of a wealthy neighbor of his uncle's. James was the couple's second child; the first child, a daughter died in infancy.
After James was born, his mother later gave birth to five daughters. Elizabeth is described as being influential in her son's education. She was said to be fond of reading Milton and Shakespeare, and for discussing public affairs with him. Buchanan began writing (but never finished) his autobiography in which he credited his mother for much of his success. He said: "She excited my ambition by presenting in glowing colors, men who had been useful to their country or their kind, as objects of imitation."
Buchanan was influenced by President George Washington, who had stayed in a nearby tavern during the Whiskey Rebellion in late 1794 or early 1795. Buchanan had three younger brothers, all born after he was 13 years old, and one was named for the first President. Another was named Edward Younger, after one of his mother's favorite poets.
Sometime around the time of the birth of James Jr. in 1791, the family moved to a larger farm in Mercersberg a few miles east. James Sr. prospered and in 1794 the family moved to a two story house in Mercersberg. James Sr. was a shrewd businessman and soon became the town's wealthiest inhabitant. There James attended the Old Stone Academy, where he studied Latin, Greek, mathematics, literature and history. He was described as being a good student, and claimed as much is his unfinished autobiography.
In 1807, sixteen year old James was sent to Dickinson College in Carlisle, Pennsylvania. In 1808 he was nearly expelled for bad behavior. He was a part of a group of unruly friends who drank at nearby taverns, engaged in food fights, committed acts of vandalism and were the subject of noise complaints from the townspeople of Carlisle. In his autobiography manuscript, Buchanan claimed that he engaged in these acts just to fit in and be one of the boys. This led to his expulsion from the school and a stern rebuke from his father. But Buchanan pleaded for a second chance, which he was given, thanks to the intercession of many of his father's connections in the Presbyterian Church, including the Presbyterian rector and some of the school's trustees. He ultimately graduated with honors on September 19, 1809, though he would later write that he really believed that he deserved highest honors. Buchanan held onto his resentment against the school. He described the school in his unfinished autobiography as being "in a wretched condition" and professed that he had "little attachment to my alma mater."
Buchanan chose not to attend college or university, deciding instead on a career in the law. After his graduation, he moved to the state capital at Lancaster. There, leading lawyer James Hopkins accepted Buchanan as an apprentice, and in 1812 he was admitted to the Pennsylvania bar. When Harrisburg became the state capital in 1812, many lawyers left Lancaster, but Buchanan made the city his lifelong home. He became a successful lawyer there, earning a very good income. He handled many types of cases, including a much-publicized impeachment trial, where he successfully defended Pennsylvania Judge Walter Franklin.
When the British invaded Maryland in 1814, Buchanan served as a private in Henry Shippen's Company, 1st Brigade, 4th Division, Pennsylvania Militia, a unit of volunteers. Buchanan is the only president with military experience who was not an officer and he was also the last president who served in the War of 1812. He would go on to be a critic of the leadership of President James Madison during that war.
In 1818, Buchanan met Anne Caroline Coleman at a grand ball at Lancaster's White Swan Inn. The two began courting. Anne was the daughter of the wealthy iron manufacturer Robert Coleman and she was also the sister-in-law of Philadelphia judge Joseph Hemphill, one of Buchanan's colleagues from the House of Representatives. By 1819, the two were engaged, but were unable to spend much time together. Buchanan claimed to be extremely busy with his law firm and political commitments during the Panic of 1819. Soon the rumor mill was churning and some suggested that Buchanan was only marrying Coleman for her money. Letters written by Anne Coleman make clear that she was aware of several rumors. Coleman broke off the engagement. On December 9, 1819, died suddenly. Though the cause of her death is unclear, there are suggestions that she died from an overdose of laudanum. Buchanan wrote her father for permission to attend the funeral, claiming "I feel happiness has fled from me forever". Robert Coleman refused to allow Buchanan to attend the funeral. Buchanan never married, leading to rumors of his possible homosexuality. The best historical sleuths agree that there is too little evidence to support any conclusions about this.