Pretreatment can be the best way to avoid hard water problems.

Source: The effects of hard water on reverse osmosis filtration systems – Water Technology Online