In some cases the surname is an Anglicised form of the Irish Ó Comhraidhe; the "h" lenites the preceding consonant, so the Anglicised form is not far from the pronunciation in Irish.
In Scotland the surname was originally Gaelic MacMhuirich however with the Highland clearances, many Gaelic names were Anglicised so the surname's took the form of something that sounded similar.