When MgCl₂ · nH₂O is heated to the boiling point of H₂O

When magnesium chloride hydrate is heated, does $$\ce{Mg(OH)2}$$ form or what? I'm curious, because Wikipedia says that it decomposes to release $$\ce{HCl}$$ gas.

Wikipedia pretty much has it all already. There are numerous magnesium chloride hydrates $$\ce{MgCl2 · x H2O}$$ $$(x = 1, 2, 4, 6, 8, 12),$$ however in the temperature range from 0 °C to 115 °C the most stable one is hexahydrate $$\ce{MgCl2 · 6 H2O}.$$

Whether $$\ce{MgCl2 · 6 H2O}$$ decomposes to hydroxo-salt or only dehydrates depends on the conditions. When heating takes place in atmosphere of $$\ce{HCl},$$ anhydrous $$\ce{MgCl2}$$ is formed:

$$\ce{MgCl2 · 6 H2O (l) ->[>\pu{115 °C}][HCl(g)] MgCl2(s) + H2O(g)}$$

Otherwise, magnesium hydroxochloride is formed [1, p. 522] and $$\ce{HCl}$$ gas is released:

The product obtained is always the hexahydrate, $$\ce{MgCl2 · 6 H2O}.$$ It is dehydrated to anhydrous magnesium chloride by spray drying and heating with dry hydrogen chloride gas. In the absence of $$\ce{HCl},$$ heating hexahydrate yields the basic salt, $$\ce{Mg(OH)Cl}:$$

$$\ce{MgCl2 · 6 H2O -> Mg(OH)Cl + HCl + 5 H2O}$$

References

1. Patnaik, P. Handbook of Inorganic Chemicals; McGraw-Hill handbooks; McGraw-Hill: New York, 2003. ISBN 978-0-07-049439-8.