Tradition links the composition of the piece to a seventeenth century blind harpist, Rory Dall O'Cahan. In 1851, Jane Ross, of Limavady, Co Londonderry, wrote down the music after hearing it played by an itinerant fiddler. The "Londonderry Air" became popular with the Irish diaspora, especially in America, and in 1910, Frederick Edward Weatherly, an English lawyer, who is thought never to have set foot in Ireland, wrote the words.
According to the book Sunshine and in Shadow: The Family Story of Danny Boy written by Weatherly's great grandson Anthony Mann, after Weatherly penned the lyrics, he struggled to find the right melody for the song. Eventually Weatherly's sister-in-law, Margaret Enright, an Irish American known as Jess, introduced the tune he was looking for when she sung "Londonderry Air" to the lyricist while visiting his home in 1912. Weatherly shaped the lyrics to the tune and published "Danny Boy" soon after. However, Frederic never acknowledged Jess's contribution, which caused a major division in the family. Mann explained to The Irish Times: "Jess, who resented for the rest of her life the fact that Fred had taken this melody and made it his own, went on (with Eddie) to die in poverty while Fred enjoyed both fame and wealth."