Heat the butter in a large sauté pan over medium heat. Add in the onions, sprinkle with salt and cook until tender and golden brown, about 15 minutes. Add the sugar and vinegar.
Lower the heat and continue cooking until the onions are a deep golden brown, about 10 minutes. Add the chile and remove the pan from the heat. Season with salt and pepper and let cool to room temperature. In a food processor, pulse the onions until a chunky puree. Add the mayo and process until smooth. Season with salt and pepper and refrigerate until ready to use.