The mainsail’s luff (forward edge) is attached to the mast, as the jib’s luff is to the forestay – but with a different mechanism.
On the aft side of the mast is a groove for the mainsail. Some sails have a boltrope on the luff that slides upward in this groove, while others have sail “slugs” mounted every foot or so on the luff. The sail slugs, as you can see in this photo just forward of the sailor’s right hand, are small plastic slides inserted into the mast groove where it widens out into a sort of gate.
Again, first inspect the whole sail to make sure it’s not twisted anywhere. Hold the main halyard in one hand during this process – you will be gradually raising the mainsail as you insert the slugs into the mast groove.
Begin with the sail slug at the head. Insert it into the groove, pull the halyard to raise the sail a little, and then insert the next slug.
Before completing this process, be sure you’re ready to go sailing soon after the mainsail is up.