Words: Samuel F. Smith, 1831. The hymn was first sung at an Independence Day celebration by the Boston Sabbath School Union, July 4, 1831, and first published in Choir, or Union Collection of Church Music, by Lowell Mason (Boston, Massachusetts: 1832).
Music: America, Thesaurus Musicus, 1744 These words were born because Smith’s friend, Lowell Mason, could not read German. Mason had received several German hymnals, and sent them to Smith, who he knew understood German. In one of them, Smith ran across the tune now used for My Country ’Tis of Thee. Noting that the German words were patriotic in nature:
I instantly felt the impulse to write a patriotic hymn of my own, adapted to the tune. Picking up a scrap of waste paper which lay near me, I wrote at once, probably within half an hour, the hymn ‘America’ as it is now known everywhere. The whole hymn stands today as it stood on the bit of waste paper.
Dr. Smith visited the Board of Trade in Chicago [Illinois] in May of 1887. While sitting in the gallery he was pointed out to the some of the members. Soon he became the center of considerable notice. All at once the trading on the floor ceased, and from the wheat-pit came the familiar words, “My country ’tis of thee.” After two stanzas had been sung, Dr. Smith arose and bowed. A rousing cheer was given by the men on the floor, to which Dr. Smith was now escorted by the secretary of the Board. The members flocked around Dr. Smith and grasped his hand. Then they opened a passage through the crowd and led him to the wheat-pit, where they took off their hats and sang the rest of the hymn.
This information was used with permission: http://www.hymntime.com/.