The psychedelic alkaloid ibogaine has anti-addictive properties in both humans and animals1. Unlike most medications for the treatment of substance use disorders, anecdotal reports suggest that ibogaine has the potential to treat addiction to various substances, including opiates, alcohol and psychostimulants. The effects of ibogaine-like those of other psychedelic compounds-are long-lasting2, which has been attributed to its ability to modify addiction-related neural circuitry through the activation of neurotrophic factor signalling3,4. However, several safety concerns have hindered the clinical development of ibogaine, including its toxicity, hallucinogenic potential and tendency to induce cardiac arrhythmias. Here we apply the principles of function-oriented synthesis to identify the key structural elements of the potential therapeutic pharmacophore of ibogaine, and we use this information to engineer tabernanthalog-a water-soluble, non-hallucinogenic, non-toxic analogue of ibogaine that can be prepared in a single step. In rodents, tabernanthalog was found to promote structural neural plasticity, reduce alcohol- and heroin-seeking behaviour, and produce antidepressant-like effects. This work demonstrates that, through careful chemical design, it is possible to modify a psychedelic compound to produce a safer, non-hallucinogenic variant that has therapeutic potential.