In a pan, melt 2-3 tbsp butter and add the onions. Cook over medium heat, stirring occasionally, until they have caramelized, about 30 minutes. (Add more butter if onion begins to stick to pan.)
When the onions are almost done, stir in the garlic and cook about 1 minute or until fragrant.
The dip can be covered and refrigerated for up to 3 days before baking and serving.