O'Leary is an anglicized version of the original Gaelic patronym Ó Laoghaire (modern: Ó Laoire).
The O'Leary clan, today associated with the Uibh Laoire parish in County Cork, is considered by scholars to have originated in the early Middle Ages on the south-west coast, in the area of Ros Ó gCairbre (Rosscarbery), of which the O'Leary were hereditary lords.
The clan traces its lineage to Lugaid Mac Con, an ancient King of Tara and High King of Ireland, and descendant of Dáire Doimthech. In the 12th century the O'Leary's were recognised hereditary wardens of St Fachtna's monastery and seat of higher learning, the School of Ross.
In more recent times, the clan, of the Corcu Loígde, was pushed north and settled in an area south-west of Macroom around Inchigeelagh on the River Lee called Uibh Laoghaire (modern; Uibh Laoire), were tradition has it that they arrived in 1192.
The book of Lecan (A.D. 1397-A.D. 1418) details the early status of O'Leary as a taisach duchusa (hereditary lord) in the tuath of Ross (Ruis).
The name also occurs in the Cineal Laoghaire branch of the Eoghanacht dynasty which later came to dominate Munster. With the unrelated Corco Laidhe and Eoghanacht branches of O'Learys settling in north-west Cork and nearby Kerry respectively, the tracing of lineage is complex.
Although almost nothing is known of their activities for several centuries, the O'Learys reappear as a still titled family in the 16th century, and were relatively wealthy, although they were subject to the McCarthy of Muskerry dynasty, from whom they received the White Wand (a symbol of authority). They were the only other freeholders in Muskerry besides the O'Mahonys, and had built several castles in their territories, of which Carrignacurra is now the only one still standing. The celebrated Irish language writer Peadar Ua Laoghaire was a descendant of the Carrignacurra branch of the family.
Auliffe O'Leary joined the side of Hugh Ó Neill, 2nd Earl of Tyrone in the Nine Years' War, from the very inception of it, and took the field with William Bourke (Clanricarde) and others. For this the chiefs of the O'Learys were eventually attained, and their lands parceled out, but because of the remoteness of their territory it was never carried out, and they remained safe there until the Cromwellian confiscations decades later. Donough MacCarty, 1st Earl of Clancarty did however appear to do his best to allow them to stay on their lands through leasing. The family became much more scattered during the later Williamite War in Ireland.
The last O'Leary lord of the Old Gaelic order was Donal MacArt O'Leary (1575–1657).