Preheat oven to 300 degrees F. Melt butter in a small saucepan; stir in rosemary, pepper and salt. Add walnuts and stir well with a rubber scraper until mixture evenly coats walnuts.
Transfer to a baking sheet and cook for 30 minutes, stirring every 10 minutes. Let cool completely before storing in an airtight container.