A well-managed compost pile should not attract rats. Only plant-based matter should be composted – never meat or meat products that produce odors that would attract rats. Don’t put cooking fats or oil, dairy products, cat litter (clean or used) or dog poop in your compost either
Using an enclosed compost bin with a lid or a rotating barrel on an elevated frame helps to prevent rats, raccoons and other animals from getting to compost.
Compost is created by natural decomposition of organic matter by bacteria, fungi, and various other small critters. Don’t panic if you see slugs, millipedes, sowbugs, beetles, or worms in your compost pile. Those are critical on-the-job workers chewing and grinding your food and yard waste into fertile soil for your garden.