Er) were synthesized by slow thermal treatment in a resistance furnace, starting from element pieces enclosed in sealed Ta crucibles. SEM-EDXS analyses were performed for monitoring the phase composition. The crystal structures of the majority of these intermetallics were investigated by X-ray diffraction on single crystals. The R 23 Ni 7 Mg 4 compounds crystallize in the Pr 23 Ir 7 Mg 4 structure type: P6 3 mc, hP68, Z = 2, for Ce a = 0.99742(1), c = 2.25206(4) nm, wR 2 = 0.0686, 1483 F 2 values, 74 variables; for Pr a = 0.99249(4), c = 2.24460(9) nm, wR 2 = 0.0735, 1395 F 2 values, 74 variables; for La a = 1.01234(8), c = 2.2887(2) nm, R B = 7.3% and R F = 5.1%. The series of isostructural R 4 NiMg compounds belongs to the Gd 4 RhIn structure type, F4 3m, cF96, Z = 16. Crystal chemical relations of R 23 Ni 7 Mg 4 with other rare earth rich intermetallics are discussed. The cubic R 4 NiMg structures are described in terms of nested polyhedra units and relations with some other cubic structures are shown on the basis of group-subgroup relations. Crystal structure / Group-subgroup relation / Mg-containing alloys