Gently melt the unsalted butter in a small saucepan or microwave until just liquid. Crucially, allow the melted butter to cool completely to room temperature before proceeding.
In a medium bowl, thoroughly whisk together the salt, black pepper, garlic powder, onion powder, brown sugar, smoked paprika, rosemary, thyme, and the optional cayenne pepper.
Gradually pour the cooled melted butter over the dry spice mixture. Stir constantly until all the spices are uniformly moistened and the rub achieves a texture resembling wet, gritty sand.
Let the finished rub sit at room temperature for 10–15 minutes. This resting time is vital as it allows the dried herbs and spices to fully absorb the butter's fat, significantly intensifying the overall flavor.
The rub is now ready to use! To save it for later, transfer the mixture to an airtight container and keep it refrigerated, where it will remain fresh for up to two weeks.