Bring a large pot of salted water to a boil and cook the elbow macaroni (or your preferred pasta) according to package instructions until al dente. Drain the pasta and set aside.
2. Caramelize the onions:
In a large skillet, melt 2 tablespoons of butter over medium heat.
Add the sliced onions and minced garlic, and cook for about 15-20 minutes, stirring occasionally, until the onions are soft, golden, and caramelized.
Sprinkle in 1 tablespoon of sugar to help with caramelization, and season with salt and pepper. Once the onions are deeply caramelized, add 1 tablespoon of flour and stir for another 1-2 minutes to create a roux.
3. Make the French onion sauce:
Slowly pour in the beef broth (or vegetable broth for a lighter version), stirring constantly to combine.
Bring the mixture to a simmer, then stir in the heavy cream. Let the sauce simmer for 3-5 minutes until it thickens slightly.
Taste the sauce and adjust with more salt and pepper if needed. Set aside.
4. Make the cheese sauce:
In the same pot you used for the pasta, melt 2 tablespoons of butter over medium heat.
Stir in the shredded cheddar cheese, Gruyère cheese, and Parmesan cheese, stirring constantly until the cheese is melted and smooth.
Add the caramelized onion sauce to the cheese mixture and stir until everything is well combined. If the sauce seems too thick, you can add a little more heavy cream or milk to loosen it up.
Season with garlic powder, onion powder, salt, and pepper to taste.
5. Combine the pasta and sauce:
Add the cooked pasta to the cheese and onion sauce. Stir well to coat the pasta evenly with the creamy sauce.
If you like a slightly crispy top, you can transfer the mac and cheese to a greased baking dish and bake at 375°F (190°C) for 10-15 minutes, or until the top is golden and bubbly.
6. Serve:
Serve your French Onion Mac and Cheese hot, garnished with freshly chopped parsley if desired. Pair with a simple green salad or enjoy it as a stand-alone comfort food.