Charged colloidal dispersions make up the basis of a broad range of industrial and commercial products, from paints to coatings and additives in cosmetics. During drying, an initially liquid dispersion of such particles is slowly concentrated into a solid, displaying a range of mechanical instabilities in response to highly variable internal pressures. Here we summarise the current appreciation of this process by pairing an advection-diffusion model of particle motion with a Poisson-Boltzmann cell model of inter-particle interactions, to predict the concentration gradients around a drying colloidal film. We then test these predictions with osmotic compression experiments on colloidal silica, and small-angle x-ray scattering experiments on silica dispersions drying in Hele-Shaw cells. Finally, we use the details of the microscopic physics at play in these dispersions to explore how two macroscopic mechanical instabilities -- shear-banding and fracture -- can be controlled.