Wash the mangoes thoroughly, peel them, remove the stones, and cut the flesh into small, even cubes. Choose mangoes that are ripe enough to be sweet but firm enough to retain some texture during cooking.
Finely chop the onion and garlic. Grate the fresh ginger and finely chop the red chili if you are using it. Preparing these ingredients before cooking makes the process easier and helps the flavors combine evenly.
Place the diced mangoes, onion, garlic, ginger, sugar, vinegar, cumin, coriander, turmeric, cinnamon, salt, and optional chili flakes in a large, heavy-bottomed saucepan. Add the raisins if you prefer a sweeter chutney with extra texture.
Heat the saucepan over medium heat, stirring gently until the sugar dissolves. Bring the mixture to a gentle simmer, then reduce the heat to low. Avoid vigorous boiling, which may cause splattering and uneven cooking.
Allow the chutney to simmer uncovered for approximately 30–40 minutes, stirring regularly to prevent sticking. The mango pieces will soften, and the mixture will gradually become thicker and more concentrated.
For a chunky chutney, gently mash a few mango pieces with the back of a spoon while leaving the rest intact. If you prefer a smoother consistency, mash more thoroughly. Continue cooking briefly if the mixture is still too thin.
Taste the chutney carefully after it has cooled slightly. Add a little extra chili for heat or a small amount of sugar if needed. Remember that the flavor will become more balanced as the chutney cools.
Remove the saucepan from the heat and let the chutney cool. Transfer it to a clean container and refrigerate promptly. For longer-term shelf-stable storage, use a tested canning recipe and the appropriate sterilization and processing procedures; this recipe is intended for refrigerated storage.