Methylene blue is used in some cases of acute hepatic porphyria, specifically to treat attacks of acute intermittent porphyria, variegate porphyria, and hereditary coproporphyria.