  We report on the detection of hydromagnesium isocyanide, HMgNC, in the
laboratory and in the carbon rich evolved star IRC+10216. The J=1-0 and J=2-1
lines were observed in our microwave laboratory equipment in Valladolid with a
spectral accuracy of 3\,KHz. The hyperfine structure produced by the Nitrogen
atom was resolved for both transitions. The derived rotational constants from
the laboratory data are $B_0$=5481.4333(6)\,MHz, $D_0$=2.90(8)\,KHz, and
$eQq(N)$=-2.200(2)\,MHz.
  The predicted frequencies for the rotational transitions of HMgNC in the
millimeter domain have an accuracy of 0.2-0.7\,MHz. Four rotational lines of
this species, J=8-7, J=10-9, J=12-11 and J=13-12, have been detected towards
IRC+10216. The differences between observed and calculated frequencies are
$<$0.5\,MHz. The rotational constants derived from space frequencies are
$B_0$=5481.49(3)\,MHz and $D_0$=3.2(1)\,KHz, i.e., identical to the laboratory
ones. A merged fit to the laboratory and space frequencies provides
$B_0$=5481.4336(4)\,MHz and $D_0$=2.94(5)\,KHz.
  We have derived a column density for HMgNC of
(6$\pm$2)$\times10^{11}$\,cm$^{-2}$. From the observed line profiles the
molecule have to be produced produced in the layer where other
metal-isocyanides have been already found in this source. The abundance ratio
between MgNC and its hydrogenated variety, HMgNC, is $\simeq$20.
