Peel and chop the pineapple. Put on gloves, then stem and seed the habaneros. Chop the onion and garlic if using.
In a saucepan over medium heat, warm the olive oil. Add chopped onion and cook for 4–5 minutes until soft. Add garlic and sauté for 1 minute until fragrant.
In a blender, combine pineapple, habaneros, vinegar, lime juice, honey, salt, and sautéed aromatics. Add optional spices if using. Blend until smooth.
Pour the mixture back into the saucepan. Simmer over medium heat for 15–20 minutes, stirring occasionally, until slightly thickened. Add a splash of water or vinegar if needed.
Carefully taste the sauce. Add more pineapple for sweetness, peppers for heat, or vinegar for extra tang. Blend again briefly if you want it smoother.
Let the sauce cool for 10–15 minutes. Pour into sterilized jars or bottles. Store in the fridge for up to 3 months.