I melt the butter in a large skillet over medium-low heat, then add the sliced onions and salt. I let them cook slowly, stirring every few minutes, for about 25 to 30 minutes. They'll shrink down a lot and turn a deep golden brown with a jammy texture.
While the onions finish cooking, I preheat my oven to 325°F. I lightly grease my cast iron skillet or casserole dish with nonstick spray so nothing sticks once the cheese starts to melt.
In a mixing bowl, I combine the softened cream cheese, mayonnaise, most of the mozzarella, most of the gruyere, the caramelized onions, chives, and black pepper. I save a little mozzarella and gruyere aside for topping later.
I spread the mixture into the prepared skillet and pop it into the oven for 20 to 25 minutes. I don't stir it right away, I just let the heat do its job until everything looks soft and melty.
Once it comes out, I stir the dip together so the cheese and onions are evenly distributed. Then I sprinkle the reserved mozzarella and gruyere over the top and return it to the oven for another 5 minutes, just until the top layer is melted and slightly golden.
I finish it with a little extra chopped chives right before serving. It's best served warm, straight from the skillet, with something sturdy to scoop it up.