Implementation of the sterile insect technique for tsetse (Glossina spp.) requires that only sterile male insects be released; thus, at some stage of the fly production process the females have to be removed. A further constraint in the use of the sterile insect technique for tsetse is that the females are needed for colony production and hence, a non-destructive method of sex separation is required. In most tsetse sterile insect technique programmes thus far, females have been eliminated from the released material by hand-separation of chilled adults. Using near-infrared (NIR) spectroscopy, significant differences have been found between the spectra for the pupae of male and female G. pallidipes Austen. Significantly, the differences appear to be maximized 4–5 days before emergence of the adults. Tsetse fly pupae up to five days before emergence can be sexed with accuracies that generally range from 80 to 100%. This system, when refined, will enable effective separation of male and female pupae to be carried out, with emerged females being returned to the colony and males being irradiated and released. If separation can be achieved five days before emergence, this will also enable irradiated male pupae to be shipped to other destinations as required. Other Diptera were evaluated using this system but had lower classification accuracies of 50–74%. This may be due to the difference in reproductive physiology between these different fly groups.