We study the bilateral trade problem put forward by Myerson and Satterthwaite (1983) under the assumption that agents are loss-averse, using the model developed by Koszegi and Rabin (2006, 2007). We show that the endowment effect increases the sellers information rent, and that the attachment effect reduces the buyer's information rent. Further, depending on the distribution of types, loss-aversion can reduce the severity of the impossibility problem. However, the result cannot be reversed. Turning to the design of optimal mechanisms, we show that in both revenue and welfare maximizing mechanisms the designer optimally provides the agents with full insurance in the money dimension and with partial insurance in the trade dimension. In fact, when the stakes are large, loss-aversion can eliminate trade altogether. We show that all results display robustness to the exact specification of the reference point and provide some results on general mechanism design problems.