In this paper, we are concerned with the study of the mathematical analysis for an optimal control of a nonlocal degenerate aggregation model. This model describes the aggregation of organisms such as pedestrian movements, chemotaxis, animal swarming. We establish the wellposedness (existence and uniqueness) for the weak solution of the direct problem by means of an auxiliary nondegenerate aggregation equation, the Faedo–Galerkin method (for the existence result) and duality method (for the uniqueness). Moreover, for the adjoint problem, we prove the existence result of minimizers and first-order necessary conditions. The main novelty of this work concerns the presence of a control to our nonlocal degenerate aggregation model. Our results are complemented with some numerical simulations.