The first-principles total energy calculations using generalized gradient approximation (GGA) and the plane wave pseudopotential method were employed to investigate the structural, elastic, electronic, and phonon properties of LaMg and YMg in the B2 (CsCl) phase. The elastic constants were derived from the stress strain relation. Lattice parameters, bulk modulus and its pressure derivative, and second order elastic constants were found to be in excellent agreement with the previous experimental and theoretical data. We also carried out the electronic band structure and the density of states (DOS) calculations for LaMg and YMg. Moreover, a linear-response approach to the density functional theory was used to derive the phonon frequencies and the phonon density of states. The temperature variation of specific heats in the range of 0-400 K were obtained using the quasi-harmonic model. (C) 2011 Elsevier Ltd. All rights reserved.