By Tony Azamfirei
Why are magic mushrooms considered to be ‘magical’? Does Atlas (our lovely wizard shown below) cast a spell in the fungi forest? In this article, we will take a journey to understand the production of the ‘magical’ (psychoactive) compound found in psychedelic mushrooms, starting from the genes responsible for enabling the production psilocybin and ending with their ingestion.
Our lovely companion Atlas
Gathering the Genetic Ingredients
Not all fungi can produce our ‘magical’ compound, psilocybin. Only a select few have this ability and are therefore labelled as ‘magic’. The difference between psilocybin-producing fungi and other fungi is their genetics, specifically a thing called the psilocybin gene cluster. In psilocybin-producing mushrooms (such as many Psilocybe and some Gymnopilus, Inocybe, Panaeolus) the key biosynthetic genes sit next to each other in the genome, forming the biosynthetic gene cluster. There are four key genes required to produce psilocybin:1
- psiD – an aromatic L-amino acid decarboxylase
- psiH – a cytochrome P450 monooxygenase
- psiK – a kinase
- psiM – an N-methyltransferase
Since these genes are physically clustered together, they can be switched on/off together, acting as a single unit that enables/disables the production of psilocybin. Now we have another question to concern ourselves with: why don’t all fungi contain the psilocybin gene cluster?
Most fungi lack psiD/H/K/M genes, meaning psilocybin cannot be produced despite the essential starting material (L-Trp) being present in every fungus on Earth. Through comparative genomics, it has been shown that the psilocybin cluster was not inherited from an ancient ancestor, but instead moved between distantly related mushroom lineages by horizontal gene cluster transfer,2 where instead of evolving slowly in a family line, the cluster was picked up from another species. One possible explanation is that the psilocybin cluster originated once or a few times in an ancestral mushroom lineage and then spread horizontally into other lineages sharing the same ecological habitats (or maybe Atlas waved his wand).2
Casting the Gene Activation Spell
Now that we have covered the basics of the psilocybin gene cluster, we can look into how it works. It all begins with a compound essential to every fungus, a building block for protein synthesis and the biosynthesis of essential compounds (such as NAD+, also known as vitamin B3), the amino acid L-tryptophan (L-Trp).3 For more information, this amino acid is produced from its precursor chorismite, which is itself made through the shikimate-chorismate pathway, but that is a grimoire for another day.4
In psilocybin-producing mushrooms, a portion of the available L-Trp is diverted from primary metabolism (e.g. protein synthesis) into secondary metabolism. When the psilocybin gene cluster is activated, the psiD gene is strongly expressed, producing the decarboxylase PsiD, which removes the carboxyl group from L-Trp to produce tryptamine, releasing CO2 in the process (as illustrated in Scheme 1)1.5 Therefore, regulation of the psilocybin genes acts like a lever, controlling how much L-Trp is diverted from core survival functions (primary metabolism) into ‘magic’ (secondary metabolism). It is also worth noting that expression of the gene cluster, and the resulting accumulation of psilocybin, is higher in the fruiting body (especially the caps and gills) than in the underground mycelium (Figure 1)6.

Scheme 1: The reaction scheme illustrates the conversion of L-tryptophan into tryptamine catalysed by PsiD.1

Figure 1: A sketch of mushroom, highlighting the fruiting body and mycelium, important for understanding where psilocybin accumulation is greater.6
Is More Than One Spell Required?
The magic has begun! But now what do we do? We are still a long way from completing the spell. Here, a new gene comes into action, calling for a second spell. The psiH gene encodes the enzyme PsiH, which performs a highly specific 4-hydroxylation on the indole ring of tryptamine, producing 4-hydroxytryptamine. The enzyme uses molecular oxygen and electrons from NADPH to introduce one oxygen atom into the substrate and reduce the other oxygen atom to water. In our magical terms, PsiH transforms tryptamine (the human) into 4-hydroxytryptamine (the frog), as shown in Scheme 2.1

Scheme 2: The reaction scheme illustrates the conversion of tryptamine into 4-hydroxytryptamine catalysed by PsiH.1
This is followed by the third enzyme, PsiK, which is encoded by psiK (starting to spot a pattern?). It takes the recently formed 4-hydroxytryptamine and transfers a phosphate group from ATP onto the 4-hydroxy group, resulting in 4‑phosphoryloxytryptamine, also known as norbaeocystin (see Scheme 3).1 The added phosphate group increases polarity, making the molecule less able to cross cell membranes and serving as a natural ‘storage tag’ that stabilises it within fungal tissues until activation, acting as both a protecting group and a prodrug handle.

Scheme 3: The reaction scheme illustrates the conversion of 4-hydroxytryptamine into 4‑phosphoryloxytryptamine catalysed by PsiK.1
The Final Wave of the Wand
Finally, we have reached the last step in making psilocybin. This step is split into two reactions, so it is technically the last two steps. The enzyme PsiM produced by the gene psiM (you guessed it!) uses S-adenosylmethionine (SAM) as a methyl donor to methylate the side chain amine in two discrete steps (as depicted in Scheme 4).1 In the first methylation PsiM converts 4‑phosphoryloxytryptamine into a baeocystin-type intermediate (monomethylated amine) which is followed by the second methylation and adds a second methyl group to yield the N,N-dimethylated amine, our magic-containing psilocybin! The active site of the enzyme discriminates between monomethylated and unmethylated amines, helping drive the production of psilocybin.

Scheme 4: The reaction scheme (i) illustrates the conversion of 4‑phosphoryloxytryptamine into a baeocystin-like intermediate and (ii) the production of psilocybin in the subsequent methylation.1
Time to Consult Our Spellbook
There’s an issue, we are lacking the magic we were promised. No, I’m not talking about the spells themselves being just chemical reactions explained by science, but rather that psilocybin, itself, is not magical (psychoactive)! There is a hidden step!
The phosphate group needs to be removed. Once psilocybin is ingested it encounters enzymes (primarily alkaline phosphatases and non-specific esterases) and is rapidly dephosphorylated into its active form, and the psychoactive compound, psilocin (as illustrated in Scheme 5)1.7 This reaction occurs within minutes of ingestion and takes places at multiple sites within the body, such as small intestines, liver, kidneys and blood,8-10 reaching a conversion rate of 90-97%.11 Psilocin passes through the blood-brain barrier and binds to serotonin receptors to induce the ‘magical’ experience when consumed.

Scheme 5: The reaction scheme for the production of psilocin that occurs when psilocybin is ingested.1
Goodbye for Atlas?
So there we have it: it turns out that Atlas is not the reason why magic mushrooms have been labelled as ‘magic’. It all has to do with the genetics, chemistry, biosynthesis and neuroscience behind the curtains. There are no real magic spells, wizard waving wands or fungi forests (probably). I have a feeling Atlas won’t be too happy reading this…
Disclaimer
This article is for educational and informational purposes only. It does not encourage, endorse, or promote the use, cultivation, possession, or consumption of psychedelic compounds, which may be illegal in many jurisdictions. The content explores the scientific biosynthesis of psilocybin and psilocin using current research, presented in an engaging and metaphorical style. Neither the author, website, nor publisher assumes responsibility for any actions taken based on this information. Consult local laws and medical professionals before engaging with any substances.
References
1 Fricke, J., Blei, F. & Hoffmeister, D. Enzymatic Synthesis of Psilocybin. Angew Chem Int Ed Engl 56, 12352-12355 (2017). https://doi.org/10.1002/anie.201705489
2 Reynolds, H. T. et al. Horizontal gene cluster transfer increased hallucinogenic mushroom diversity. Evol Lett 2, 88-101 (2018). https://doi.org/10.1002/evl3.42
3 Janevska, S. et al. Optimized psilocybin production in tryptophan catabolism-repressed fungi. Microb Biotechnol 17, e70039 (2024). https://doi.org/10.1111/1751-7915.70039
4 Tzin, V. & Galili, G. The Biosynthetic Pathways for Shikimate and Aromatic Amino Acids in Arabidopsis thaliana. The Arabidopsis book / American Society of Plant Biologists 8, e0132 (2010). https://doi.org/10.1199/tab.0132
5 Gibbons, W. J., Jr., McKinney, M. G., O’Dell, P. J., Bollinger, B. A. & Jones, J. A. Homebrewed psilocybin: can new routes for pharmaceutical psilocybin production enable recreational use? Bioengineered 12, 8863-8871 (2021). https://doi.org/10.1080/21655979.2021.1987090
6 Why All Host Defense Supplements Are Powered by Mushroom Mycelium, <https://hostdefense.com/blogs/host-defense-blog/mycelium-explained> (2021).
7 Dodd, S. et al. Psilocybin in neuropsychiatry: a review of its pharmacology, safety, and efficacy. CNS Spectrums 28, 416-426 (2023). https://doi.org/10.1017/S1092852922000888
8 Horita, A. & Weber, L. J. The enzymic dephosphorylation and oxidation of psilocybin and pscilocin by mammalian tissue homogenates. Biochemical Pharmacology 7, 47-54 (1961). https://doi.org/https://doi.org/10.1016/0006-2952(61)90124-1
9 Otto, M. E. et al. Clinical Pharmacokinetics of Psilocin After Psilocybin Administration: A Systematic Review and Post-Hoc Analysis. Clinical Pharmacokinetics 64, 53-66 (2025). https://doi.org/10.1007/s40262-024-01454-4
10 Thomann, J. et al. In vitro and in vivo metabolism of psilocybin’s active metabolite psilocin. Frontiers in Pharmacology Volume 15 – 2024 (2024). https://doi.org/10.3389/fphar.2024.1391689
11 Strauss, D., Ghosh, S., Murray, Z. & Gryzenhout, M. Psilocybin containing mushrooms: a rapidly developing biotechnology industry in the psychiatry, biomedical and nutraceutical fields. 3 Biotech 12, 339 (2022). https://doi.org/10.1007/s13205-022-03355-4
