The origins of the song are unclear, but it has been traced to an Irish language song, "Do bhí bean uasal" ("There Was a Noblewoman"), which is attested to the poet Cathal Buí Mac Giolla Ghunna, who died in 1745 in County Clare.
The song appears on a ballad sheet in Cork City in the mid nineteenth century in macaronic form. The Irish lyrics were about a man being cuckolded, a bawdy and humorous ditty. By contrast, the English lyrics are nostalgic.
With the Industrial Revolution, a linen-trade developed between Co. Antrim (where Carrickfergus is situated), and Co. Cork. It is possible the English lyrics came from snatches picked up in interactions between the Cork men and the Antrim men.
Robert Gogan suggests Carrickfergus may have evolved from at least two separate songs which would explain why it does not have a consistent narrative. For example, the Ancient Music of Ireland, published by George Petrie in 1855, contained a song called "The Young Lady" which featured many but not all of the lyrics used in Carrickfergus. Gogan also refers to a recording of a song called "Sweet Maggie Gordon" which is kept in the Music for the Nation section of the US Library of Congress. It was published by Mrs Pauline Lieder in New York in 1880. It contains verses which are similar to Carrickfergus, but the chorus is closer to another Irish/Scottish folk song called "Peggy Gordon".
In modern times, "Carrickfergus" became known after actor Peter O'Toole related it to Dominic Behan, who put it in print and made a recording in the mid-1960s. The middle verse was allegedly written by Behan.
The song has been recorded by many well known performers including Ryan Kelly, Celtic Thunder, Paddy Reilly, Declan Affley, Joan Baez, Bryan Ferry, Dominic Behan, Charlotte Church, The Clancy Brothers and Tommy Makem, Brian Dunphy, De Dannan, Subway to Sally, Joe Dassin (as Mon village du bout du monde), The Dubliners, Garnet Rogers, Brian Kennedy, Declan Galbraith, Irish Stew of Sindidun, Lisa Kelly, Cedric Smith, with Loreena McKennitt on harp (as Carrighfergus), Órla Fallon, Van Morrison, Bryn Terfel, Van Morrison and the Chieftains, Ronan Keating, Katherine Jenkins and Allison Moorer. It was also adapted in Scooter's song "Where the Beats...". The song is a popular request at folk festivals and concerts, and was played at the 1999 funeral of John F. Kennedy, Jr. The song was more recently performed by Loudon Wainwright III over the closing credits of HBO's series Boardwalk Empire. Furthermore, the Russian singer-songwriter Aleksandr Karpov (a.k.a. "Aleksandr O'Karpov") translated the lyrics into Russian, recording a Russian version of "Carrickfergus", also titled "За синим морем, за океаном" (Za sinim morem, za okeanom - "Beyond the blue sea, beyond the ocean").
Closely related is the song The Water is Wide, similar tune and very similar lyrics in some lines. Recordings by loads of people including Dylan (Live), Pete Seeger, The Seekers and two former Byrds, Roger Mcguinn and Chris Hillman, who both did solo versions.