1: \begin{abstract}
2: In numerical magnetohydrodynamics (MHD), a major challenge is maintaining $\divB=0$. Constrained transport (CT) schemes achieve this but have been restricted to specific methods. For more general (meshless, moving-mesh, ALE) methods, ``divergence-cleaning'' schemes reduce the $\divB$ errors; however they can still be significant and can lead to systematic errors which converge away slowly. We propose a new constrained gradient (CG) scheme which augments these with a projection step, and can be applied to any numerical scheme with a reconstruction. This iteratively approximates the least-squares minimizing, globally divergence-free reconstruction of the fluid. Unlike ``locally divergence free'' methods, this actually minimizes the numerically unstable $\divB$ terms, without affecting the convergence order of the method. We implement this in the mesh-free code {\small GIZMO} and compare various test problems. Compared to cleaning schemes, our CG method reduces the maximum $\divB$ errors by $\sim1-3$ orders of magnitude ($\sim2-5$\,dex below typical errors if no $\divB$ cleaning is used). By preventing large $\divB$ at discontinuities, this eliminates systematic errors at jumps. Our CG results are comparable to CT methods; for practical purposes, the $\divB$ errors are eliminated. The cost is modest, $\sim 30\%$ of the hydro algorithm, and the CG correction can be implemented in a range of numerical MHD methods. While for many problems, we find Dedner-type cleaning schemes are sufficient for good results, we identify a range of problems where using only Powell or ``8-wave'' cleaning can produce order-of-magnitude errors.
3: \end{abstract}
4: