I found how to add MAME games to RetroArch on macOS.
Download the MAME XML database, for example from progettosnaps.net/dats/MAME/. Find the DAT archive for your version — in my case, version 0.139. Then, place this XML file into your MAME ROMs folder.
In RetroArch, choose Scan / Import MAME...