The activation of acceptors was investigated for Mg-doped, heteroepitaxial layers of GaN grown by metalorganic chemical vapor deposition. After growth the samples were exposed to isochronal rapid thermal anneals in the temperature range from 500°C to 775°C. The samples were studied by variable temperature Hall effect measurements and photoluminescence (PL) spectroscopy in the as-grown condition and after each temperature step. The thermal treatment leads to the formation of acceptors which are characterized by an activation energy for ionization in the range between 165 meV and 182 meV. These acceptors are attributed to Mg atoms substituting for Ga in the GaN lattice. The experimental results for the acceptor activation are consistent with the dissociation of electrically inactive acceptor-hydrogen complexes. The reversibility of this process is investigated by the exposure of the activated, p-type GaN samples to atomic hydrogen in a remote-plasma hydrogenation system at 600°C and reactivating at 850°C.