1Put the garlic in the bowl of a food processor and pulse until coarsely chopped. Toss in the nuts, Parmesan, if using, pepper and salt and chop until the nuts are finely crushed, about 1 minute. Add the basil, oil and lemon juice and pulse for 1 minute more, until smooth. Stir in red pepper flakes, if desired.
2To store, transfer the pesto to a sterilized jar with a tight-fitting lid. Pour a thin layer of olive oil on top of the pesto, seal and refrigerate up to 10 days or freeze up to 3 months.