Psychedelic mushrooms are slowly coming out of the shadows of illegality. In addition to their well-known recreational uses, they are now being recognized as a potential source of medicine for various ailments that afflict humans and animals.
Magic mushrooms contain a long list of alkaloids that cause many known and unknown effects. Of these chemicals, psilocybin and its psychedelic byproduct psilocin are the most familiar. Thus, these are the substances most often extracted from mushrooms.
Extractors have a few methods at their disposal to “capture” the magical psilocybin. Nonetheless, official options remain limited.
Take Hielscher’s cold-water ultrasonic extraction. This method uses cold water as a medium for the mushrooms, which keeps the source material from degrading due to temperature. Source material is then subjected to ultrasonic waves at 20kHz, or 20,000 vibrations per second. These sound waves eventually cause the cell walls of the mushrooms to break down, which leads to the release of the sought-after psilocybin and other components, including psilocin and analogues baeocystin and norbaeocystin.
Another form of ultrasonic extraction (also available from Hielscher) uses methanol or ethanol instead of water. Both are suitable for extracting psilocybin. However, using water is much cheaper, safer (less toxic), and cleaner than using alcohol solvents.
DIY extractors are known to use ethanol and water maceration by pulverizing the mushrooms, soaking, filtering, and evaporating. As psilocybin is water soluble , some will simply make hot tea. A few use lemon juice with the idea that the acidic environment promotes conversion of psilocybin to psilocin.
Another method of extracting psilocybin is through the use of acetic acid. The pulverized mushroom material is mixed with a dilution of acetic acid, which is then heated in a boiling water bath after a one-hour incubation period (converting psilocybin to psilocin). Afterwards, the acid is treated with ammonium hydroxide and then extracted using diethyl ether. The ether is then evaporated over sodium sulfate and crystallized using chloroform and heptane (1:3). Although many chemicals are used with this method (which may make it more cumbersome, toxic, and expensive), the benefit to this technique lies in the purity of the resultant psilocybin extract.
As magic mushrooms continue to push their way into mainstream society, researchers and industry professionals will refine extraction processes and even develop new ones to efficiently and safely extract psilocybin. Existing botanical extraction equipment may be viable for mushrooms but remains unadvertised. That said, psilocybin is considered insoluble in organic solvents. 
- Mahmood ZA. Bioactive alkaloids from fungi: psilocybin. Natural Products. 2013:523–552.doi:10.1007/978-3-642-22144-6_19. [Impact Factor: 4.050; Times Cited: 1 (Semantic Scholar)]