I live in Ireland. The simple last initial form is the most commonly used:
McDonald > M.
MacDonald > M.
Macdonald > M. (this is a Scottish name)
O'Brien > O.
The other option (which I prefer) is to include the entire surname up to the second capital letter, thus:
McDonald > McD.
MacDonald > MacD.
Macdonald > M. (no change there)
O'Brien > O'B.
I've never seen
McDonald > MD
MacDonald > MD
You might see
O'Brien > OB
but that's probably just people having trouble with apostrophes.
Some people introduce spaces and write O'Brien as O Brien, MacDonald as Mac Donald, and McDonald as Mc Donald. This seems iffy to me in English, though the prefixes do derive from independent Irish words. But if a man is going to give his surname as Ó Briain, I would expect his sister's surname to be Ní Briain.