How to caramelize onions:
Cut onions into 1/4-1/2 inch thick rings. Put them in a cold, heavy skillet with just enough olive oil to lightly cover the bottom of the pan. Start them cooking over medium heat.
When the onions have softened a little, salt them, cover the pan, and reduce the heat to low. The salting will draw moisture from the onions; the lid will concentrate the heat.
Cook them, stirring every 10-15 minutes, until limp and beginning to color, about 45 minutes.
Raise the heat slightly and remove the lid. They will finish coloring in another five minutes. If you want to add garlic, do it only at the last stage. Garlic contains much less moisture and will scorch a lot earlier.
From How to Pick a Peach, page 66