In a large skillet, heat olive oil over medium-low heat. Add the sweet potatoes to the skillet, stirring to evenly coat with oil. Season with salt and pepper and cover. Allow the potatoes to cook for 10-12 minutes, stirring occasionally. Add the onion, rosemary, and garlic to the skillet and stir to combine, cook until potatoes are tender and slightly brown, another 8-10 minutes.