Melt the butter in a large skillet or dutch oven over medium-low heat. Add the onions, 1/2 teaspoon of the salt, and 1/4 teaspoon of the black pepper. Cook, stirring occasionally, for 35-45 minutes, until the onions are very soft and deeply golden. If the bottom of the pan ever looks like it’s getting too dark, add a splash of water and scrape up the brown bits with a spatula, stirring them back into the onions.
2 tablespoons unsalted butter, 2 large yellow onions, ½ teaspoon fine sea salt, ¼ teaspoon Freshly ground black pepper
Add the garlic and thyme and cook for 1 minute, until fragrant.
2 cloves garlic, 1 tablespoon fresh thyme leaves
Add the heavy cream and bring to a gentle simmer over medium heat. Cook for 3-4 minutes, stirring occasionally, until the cream has reduced slightly. Remove from the heat and stir in the nutmeg and remaining 1/2 teaspoon salt and 1/4 teaspoon black pepper.
½ teaspoon fine sea salt, ¼ teaspoon Freshly ground black pepper, 1 1/2 cups heavy cream, 1/4 teaspoon freshly grated nutmeg
Preheat the oven to 350 degrees F. Butter a 9-by-13-inch baking dish.
Arrange half of the potato slices in overlapping rows in the prepared baking dish, overlapping each slice by about 1/3 to 1/2 and slightly overlapping each row. Pour half of the onion-and-cream mixture evenly over the potatoes.
2 pounds Yukon Gold potatoes
Arrange the remaining potato slices over the first layer in the same overlapping pattern. Pour the remaining onion and cream mixture evenly over the top, making sure it reaches between the slices.
Cover the baking dish tightly with aluminum foil and bake for 45 minutes.
Remove the foil and sprinkle the Gruyère evenly over the top. Continue baking for 30-35 minutes, until the potatoes are completely tender when pierced with a knife and the cheese is golden and bubbling.
1 1/2 cups shredded Gruyère cheese
Let the gratin rest for 10-15 minutes. Garnish with fresh thyme and serve warm.