Just like acid halides react with water to form carboxylic acids, they react with alcohol to produce esters in an analogous reaction called alcoholysis. As acid halides are the most reactive acyl derivatives, alcoholysis does not require an acid or a base catalyst. The first step of the mechanism involves a nucleophilic attack by the alcohol at the carbonyl carbon, forming a tetrahedral intermediate. In the next step, the carbon–oxygen double bond is re-formed with the departure of a halide ion as the leaving group. Lastly, deprotonation gives an ester as the final product. With acid chlorides, HCl is formed as a by-product. So, pyridine is added to neutralize the HCl and prevent unwanted side reactions. Additionally, the reaction outcome is influenced by steric factors. For example, if the alcohol has primary and secondary hydroxyl groups, the unhindered primary alcohol is selectively esterified over the hindered secondary alcohol.