Certain endangered Thymelaeaceous trees are major sources of the fragrant and highly valued resinous agarwood, comprised of hundreds of oxygenated sesquiterpenoids (STPs). Despite growing pressure on natural agarwood sources, the chemical complexity of STPs severely limits synthetic production. Here, we catalogued the chemical diversity in 58 agarwood samples by two-dimensional gas chromatography–mass spectrometry and partially recreated complex STP mixtures through synthetic biology. We improved STP yields in the unicellular algaChlamydomonas reinhardtiiby combinatorial engineering to biosynthesise nine macrocyclic STP backbones found in agarwood. A bioprocess following green-chemistry principles was developed that exploits ‘milking’ of STPs without cell lysis, solvent–solvent STP extraction, solvent–STP nanofiltration, and bulk STP oxy-functionalisation to obtain terpene mixtures like those of agarwood. This process occurs with total solvent recycling and enables continuous production. Our synthetic-biology approach offers a sustainable alternative to harvesting agarwood trees to obtain mixtures of complex, fragrant, oxygenated STPs.