Combining historical climatology and environmental history, this article examines the diverse range of strategies deployed by the city government of Barcelona (Catalonia, NE Spain) to confront the recurrent drought episodes experienced between 1626 and 1650. Our reconstruction of drought in Barcelona for the period 1525-1821, based on pro pluvia rogations as documentary proxy data, identifies the years 1626-1635 and the 1640s as the most significant drought events of the series (highest drought frequency weighted index and drought duration index). We then focus on the period 1601-1650, providing a timeline that visualises rain rogation levels in Barcelona at a monthly resolution. Against this backdrop, we examine institutional responses to drought and discuss how water scarcity was perceived and confronted by Barcelona city authorities. Among the several measures implemented, we present the ambitious water supply projects launched by the city government, together with the construction of windmills as an alternative to watermills, as a diversification strategy aimed at coping better with diminishing water flows. We pay special attention to the institutional efforts to codify the knowledge about Barcelona's water supply, which in 1650 resulted in the Book of Fountains of the City of Barcelona (Llibre de les Fonts de la Ciutat de Barcelona). This manual of urban water supply, written by the city water officer after 3 decades of experience in his post, constitutes a rare and valuable source to study water management history but also includes significant information to interpret historical climate. We analyse the production of this manual in the context of 3 decades marked by recurrent episodes of severe drought. We interpret the city government aspiration to codify knowledge about urban water supply as an attempt to systematise and store historical information on infrastructure to improve institutional capacities to cope with future water scarcities.