The lifetime of the $B_c^+$ meson is measured using semileptonic decays having a $J!/!psi$ meson and a muon in the final state. The data, corresponding to an integrated luminosity of $2mathrm{~fb^{-1}}$, are collected by the LHCb detector in $pp$ collisions at a centre-of-mass energy of $8,mathrm{TeV}$. The measured lifetime is $$tau = 509 pm 8 pm 12 mathrm{~fs},$$ where the first uncertainty is statistical and the second is systematic.