O Captain! My Captain! was first published in 1865 in Sequel to drum-Taps. The poem was included in Leaves of Grass in 1867 and subsequent editions.