One of the most exciting developments in astronomy is the discovery of planets around stars other than our Sun. More than two thousand exo-planets have now been detected. But how do these planets form, and why are they so different from those in our own solar system? Which ingredients are available to build them? Thanks to powerful ground-based telescopes such as the Atacama Large Millimeter Array (ALMA) and soon the James Webb Space Telescope (JWST), we are now in a position to address these age-old questions scientifically. The formation of stars and planetary systems takes place in «molecular clouds». These dense, cold, dust enshrouded regions of the interstellar medium exhibit a high degree of molecular complexity. I will discuss how this complexity develops in protostellar envelopes, and how far it progresses before the molecules are incorporated as ices into planetesimals in protoplanetary disks and delivered to planets in the habitable zone.