NMR systems based on magnets build from permanent magnetic materials offer a number of advantages in terms of system mobility, maintenance, robustness and cost compared to standard superconducting magnets. Moreover they can be miniaturized in an easier way since they do not required cryo-cooling. However, in the last decades such magnets have been commercialized as so-called “time-domain” systems only suitable for relaxation and diffusion measurements. Although high-resolution spectroscopy has been achieved in the sixties and seventies with permanent magnets (like the model T-60 from varian) the size of those magnets is comparable to the one of superconducting magnets today. Shrinking the magnet has systematically led to ruin the field homogeneity achieved in standard sample volumes. To achieve spectroscopy resolution in desktop magnets a reduction of the sample volumes more than three orders of magnitude is required which seriously compromises the signal-to-noise ratio of the system. The issues limiting the achievable field homogeneity are imposed by the physical properties of the magnetic material and mechanical errors in size and positioning of the magnet blocks in the array, which are of the order of few percents (1% = 10000 ppm). The main goal of this project has been to develop a shimming strategy that can be applied to permanent magnets in order to recover the field homogeneity predicted by the simulations. Assuming that the magnet array is built from imperfect pieces, the errors can be corrected by moving at least some of the blocks composing the array. To implement this strategy in an efficient way we needed, first, to work out a compact magnet geometry that does not lose efficiency when blocks are moved. Second, to implement a numerical procedure to calculate the magnetic field quick and accurately. Third, to develop a fast field mapping method to measure the magnetic field inhomogeneities with high accuracy. Once these main steps were fulfilled the goal was set to build the smallest magnet still generating a homogeneous spot to fit standard 5-mm NMR tubes. The high sensitivity achieved by keeping the sample volume as large as in conventional high-field machines and the high-resolution achieved with the proposed shimming method has proven to boost the performance of small magnets several orders of magnitude. Weighing only 500 grams, the magnet prototype built in the project can be carried to where needed, and the NMR measurements can be performed on demand at zero maintenance cost of the device. This was demonstrated by installing the setup in a chemistry fume hood to follow reactions online. The novel magnet array developed in this project was scaled up to build a desktop MRI tomograph working on samples 40 mm in diameter. The technological development achieved in this project is of high commercial interest and has been patented by the RWTH. Today several companies are competing hard to establish ultra compact high resolution NMR as a routine method in the chemistry lab.