To maximize a desired product, metabolic engineers typically express enzymes to high, constant levels. Yet, permanent pathway activation can have undesirable consequences including competition with essential pathways and accumulation of toxic intermediates. Faced with similar challenges, natural metabolic systems compartmentalize enzymes into organelles or post-translationally induce activity under certain conditions. Here we report that optogenetic control can be used to extend compartmentalization and dynamic control to engineered metabolisms in yeast. We describe a suite of optogenetic tools to trigger assembly and disassembly of metabolically active enzyme clusters. Using the deoxyviolacein biosynthesis pathway as a model system, we find that light-switchable clustering can enhance product formation six-fold and product specificity 18-fold by decreasing the concentration of intermediate metabolites and reducing flux through competing pathways. Inducible compartmentalization of enzymes into synthetic organelles can thus be used to control engineered metabolic pathways, limit intermediates and favor the formation of desired products.