A magnetosphere may form around an object in a stellar wind either due to the intrinsic magnetic field of theobject or stellar wind interaction with the ionosphere of the object. Comets represent the most variable magnetospheres in our solar system, and through the Rosetta mission we have had the chance to study the birth and evolution of a comet magnetosphere as the comet nucleus approached the Sun. We review the birth of the cometmagnetosphere as observed at comet 67P Churyumov–Gerasimenko, the formation of plasma boundariesand how the solar wind–atmosphere interaction changes character as the cometary gas cloud and magnetospheregrow in size. Mass loading of the solar wind leads to an asymmetric deflection of the solar wind for low outgassingrates. With increasing activity a solar wind ion cavity forms. Intermittent shock-like features were also observed.For intermediate outgassing rate a diamagnetic cavity is formed inside the solar wind ion cavity, thus well separated from the solar wind. The cometary plasma was typically very structured and variable. The region of thecoma dense enough to have significant collisions forms a special region with different ion chemistry and plasmadynamics as compared to the outer collision-free region.