The invention provides compounds for selectively inhibiting glycosidases,prodrugs of thecompounds, and pharmaceutical compositions including the compounds or prodrugsof thecompounds. The invention also provides methods of treating diseases anddisorders related todeficiency or overexpression of O-GlcNAcase, accumulation or deficiency of O-GlcNAc.