Build good habits at an early age. Imagine spending your entire life in one small environment and then suddenly finding yourself somewhere totally different. That’s how it can feel for some older cats, so expose him or her to new people and places as a kitten.
Get your cat comfortable with the carrier. Leave it open in a place where it is always accessible and fill it with bedding and toys. Put your cat’s food in the carrier or give treats in it. You can even shut the door from time to time and pick it up and walk around. These things will prevent any negative associations with the carrier.