Boil macaroni in salted water according to package directions. Once cooked, drain the macaroni and place back into the pot, leaving it off the heat to cool down.
Melt butter in a skillet over medium heat. Add onions, cook until softened and slightly caramelized. Scrape the onions and melted butter into the pot with the macaroni. Stir to combine.
In a large bowl, beat eggs until fluffy. Add milk, salt, pepper, garlic powder, dry mustard, dried thyme and cayenne pepper. Stir to combine.
Pour the egg mixture over the macaroni and stir until well coated.
Stir in 3 cups of the shredded cheese.
Pour into a greased, 9x11 baking dish and top with reserved ½ cup of shredded cheese.
Bake until the pie is firm, and the top is golden brown. About 35-40 minutes.
Allow pie to rest for 10-15 minutes before serving.
Cold cheese is easier to shred than warm cheese
This dish is traditionally made with Trinidad-style cheese (New Zealand cheddar) but you can use any cheddar you like, or use a mixture of cheddar and mozzarella.
Aged cheddar will taste more "cheesy" than a mild cheddar
If the cheese on top begins to brown too quickly, cover it with tin foil for the remaining baking time
Please note that the nutritional information for this recipe is only an estimate, and has been calculated using a plugin. EDITED AUG. 19, 2018: Dried thyme reduced to 1/2 tsp from 1 tsp based on reader feedback.