The text was written by Phillips Brooks (1835–1893), an Episcopal priest, rector of the Church of the Holy Trinity, Philadelphia. He was inspired by visiting the village of Bethlehem in the Sanjak of Jerusalem in 1865. Three years later, he wrote the poem for his church and his organist, Lewis Redner, added the music.
Redner’s tune, simply titled “St. Louis“, is the tune used most often for this carol in the United States. Redner recounted the story of his composition in 1924:
As Christmas of 1868 approached, Mr. Brooks told me that he had written a simple little carol for the Christmas Sunday-school service, and he asked me to write the tune to it. The simple music was written in great haste and under great pressure. We were to practice it on the following Sunday. Mr. Brooks came to me on Friday, and said, ‘Redner, have you ground out that music yet to “O Little Town of Bethlehem”? I replied, ‘No,’ but that he should have it by Sunday. On the Saturday night previous my brain was all confused about the tune. I thought more about my Sunday-school lesson than I did about the music. But I was roused from sleep late in the night hearing an angel-strain whispering in my ear, and seizing a piece of music paper I jotted down the treble of the tune as we now have it, and on Sunday morning before going to church I filled in the harmony. Neither Mr. Brooks nor I ever thought the carol or the music to it would live beyond that Christmas of 1868.
My recollection is that Richard McCauley, who then had a bookstore on Chestnut Street west of Thirteenth Street, printed it on leaflets for sale. Rev. Dr. Huntington, rector of All Saints’ Church, Worcester, Mass., asked permission to print it in his Sunday-school hymn and tune book, called The Church Porch, and it was he who christened the music ‘Saint Louis.’