Disclosed herein is a method for treating shale gas produced water. The method comprises adding a magnesium containing pH raising agent to the produced water, whereby a precipitate comprising magnesium hydroxide is formed; adding a source of carbonate ions to the produced water, whereby a carbonate containing precipitate is formed; and removing the precipitate to provide a treated water.