Bring a large pot of salted water to a boil and cook the pasta according to the manufacturer's instructions for al dente pasta.
Meanwhile, put the mint leaves, pistachios and garlic in the bowl of a food processor and pulse until finely chopped. While still pulsing, slowly drizzle in the olive oil. Remove the lid and use your hands to break up the wedge of pecorino into small chunks and add them to the food processor along with a pinch of salt and pepper. Pulse until well combined but there are still small pieces of pecorino throughout the mixture. (You do not want to blend too much because it will cause the mint to brown.) Season with additional salt and pepper if needed.
Transfer the pesto to a large high-sided skillet. When the pasta is cooked to al dente, use a large slotted spoon to lift the pasta out of the pot and directly into the skillet. Stir to combine. Turn the heat to medium-high and cook, stirring occasionally, until the excess water from the pasta has evaporated and some of the pecorino has started to melt, 3 to 5 minutes. Stir in the lemon juice and butter if using. Season with additional salt and pepper if needed.
Transfer to a large platter and garnish with the grated pecorino and whole mint leaves. Serve warm or at room temperature.
To toast pistachios, spread them in a single layer on a rimmed baking sheet and roast at 350 degrees F until fragrant and beginning to color, 8 to 10 minutes. Allow to cool before adding to the food processor.
Recipe courtesy of David Burtka