How to erase PIC microcontroller?
It sounds like you're using MPLAB X.

In general, there's no need to erase a flash-based PIC part prior to reprogramming. The IDE will take care of that for you.

If for some reason you really do need to do a manual erase, you will need to either:


Use MPLAB 8 (which supports PICkit2), or
Get a new programmer (PICkit3/PM3/ICD3/REAL ICE) and use the MPLAB X IPE program (integrated programming environment) that comes with MPLAB X.


You can install MPLAB 8 at the same time as MPLAB X, and they won't interfere (much) with each other. The PICkit2 doesn't require you to do anything fancy like run the driver switcher either (some programmers use different drivers for MPLAB 8 and X, and you need to use the driver switcher utility)

EDIT: With MPLAB X v1.7 and v1.85, you can indeed still use PICkit2 (despite Leon's comment)



It's not 100% supported (hence the amber lights) but I've used it on a variety of PIC24 and PIC16 projects successfully.