Heat the oil in a medium, lidded cast-iron skillet over medium heat. When it’s shimmering, add the rosemary. Cook for about 1 minute, then remove the sprig, setting it aside on a plate to cool.
Add the onion and garlic and reduce the heat to medium-low. Cook until the onion softens, about 5 minutes.
Add the sprouts and increase the heat to medium-high.
Chop up a bit of the fried rosemary leaves (discarding the woody stem) and add them to the pan. Stirring frequently, cook until the sprouts are golden on the edges, about 5 minutes.
Use a large spoon to create 4 wells in the sprouts and carefully pour an egg into each. Reduce the heat to medium-low, cover, and cook for 2 to 3 minutes, until the eggs are set.
To serve, using a large spoon, carefully scoop from under each egg, gathering a bit of the sprout hash as you go. Season with salt and pepper to taste.