  The deuteration of molecules forming in the ices such as methanol (CH$_3$OH)
is sensitive to the physical conditions during their formation in dense cold
clouds and can be probed through observations of deuterated methanol in hot
cores. Observations with ALMA containing transitions of CH$_3$OH, CH$_2$DOH,
CHD$_2$OH, $^{13}$CH$_3$OH, and CH$_3^{18}$OH are investigated. The column
densities of CH$_2$DOH, CHD$_2$OH, and CH$_3$OH are determined for all sources,
where the column density of CH$_3$OH is derived from optically thin $^{13}$C
and $^{18}$O isotopologues. Consequently, the D/H ratio of methanol is derived
taking statistical effects into account. Singly deuterated methanol (CH$_2$DOH)
is detected toward 25 of the 99 sources in our sample of the high-mass
protostars. Including upper limits, the $\rm (D/H)_{CH_3OH}$ ratio inferred
from $N_\mathrm{CH_2DOH}/N_\mathrm{CH_3OH}$ was derived for 38 of the 99
sources and varies between $\sim10^{-3}-10^{-2}$. Including other high-mass hot
cores from the literature, the mean methanol D/H ratio is
$1.1\pm0.7\times10^{-3}$. This is more than one order of magnitude lower than
what is seen for low-mass protostellar systems ($2.2\pm1.2\times10^{-2}$).
Doubly deuterated methanol (CHD$_2$OH) is detected toward 11 of the 99 sources.
Including upper limits for 15 sources, the $\rm (D/H)_{CH_2DOH}$ ratios derived
from $N_\mathrm{CHD_2OH}/N_\mathrm{CH_2DOH}$ are more than two orders of
magnitude higher than $\rm (D/H)_{CH_3OH}$ with an average of
$2.0\pm0.8\times10^{-1}$ which is similar to what is found for low-mass
sources. Comparison with literature GRAINOBLE models suggests that the
high-mass prestellar phases are either warm ($>20$ K) or live shorter than the
free-fall timescale. In contrast, for low-mass protostars, both a low
temperature of $<15$ K and a prestellar phase timescale longer than the
free-fall timescale are necessary.
