In open pit mining, one must dig a pit, that is, excavate the upper layers of ground before reaching the ore. The walls of the pit must satisfy some mechanical constraints, in order not to collapse. The question then arises how to mine the ore optimally, that is, how to find the optimal pit. We set up the problem in a continuous (as opposed to discrete) framework, and we show, under weak assumptions, the existence of an optimum pit. For this, we formulate an optimal transportation problem, where the criterion is lower semi-continuous and is allowed to take the value +∞. We show that this transportation problem is a strong dual to the optimum pit problem, and also yields optimality (complementarity slackness) conditions.