Coelho wrote The Alchemist in only two weeks in 1987. He explained that he was able to write at this pace because the story was "already written in [his] soul."
The book's main theme is about finding one's destiny, although according to The New York Times, The Alchemist is "more self-help than literature". The advice given to Santiago that "when you really want something to happen, the whole universe will conspire so that your wish comes true" is the core of the novel's philosophy and a motif that plays throughout it.
The Alchemist was first released by Rocco, an obscure Brazilian publishing house. Albeit having sold "well," the publisher after a year decided to give Coelho back the rights. Needing to "heal" himself from this setback, Coelho set out to leave Rio de Janeiro with his wife and spent 40 days in the Mojave Desert. Returning from the excursion, Coelho decided he had to keep on struggling and was "so convinced it was a great book that [he] started knocking on doors."