Inclusion Criteria:  1. Subjects provided written informed consent to participate. For adolescent subjects, both adolescent assent and parental consent will be provided. 2. Subjects who complete MT-7117-G01 (complete through Week 58 [Visit 12]) 3. Subjects have a body weight of ≥30 kg. 4. Subjects are willing and able to travel to the study sites for all scheduled visits. 5. In the Investigator's opinion, subject can understand the nature of the study and any risks involved in participation, and is willing to cooperate and comply with the protocol restrictions and requirements (including travel). 6. Female subjects who are non-lactating and have a negative urine pregnancy test at baseline visit prior to receiving the first dose of study drug. 7. Female subjects of childbearing potential and male subjects with partner of childbearing potential must agree to use 2 effective methods of contraception including barrier method (especially for female subjects, one method must be highly effective method)  Exclusion Criteria:  A subject will NOT be eligible for this study if ANY of the following criteria apply:  1. History or presence of photodermatoses other than EPP or XLP. 2. Presence of clinically significant hepatobiliary disease at Screening. 3. Subjects with AST, ALT, ALP ≥3.0 × upper limit of normal (ULN) or total bilirubin >1.5 × ULN at Screening. 4. Subjects with or having a history (in the last 2 years) of excessive alcohol intake in the opinion of the Investigator. 5. History of melanoma. 6. Presence of melanoma and/or lesions suspicious for melanoma at Screening. 7. History of familial melanoma (defined as having 2 or more first-degree relatives, such as parents, sibling and/or child). 8. Presence of squamous cell carcinoma, basal cell carcinoma, or other malignant skin lesions. Any suspicious lesions or nevi will be evaluated. If the suspicious lesion or nevi cannot be resolved through biopsy or excision, the subject will be excluded from the study. 9. History or presence of psychiatric disease judged to be clinically significant by the Investigator and which may interfere with the study evaluation and/or safety of the subjects. 10. Presence of clinically significant acute or chronic renal disease based upon the subject's medical records including hemodialysis; an estimated glomerular filtration rate (eGFR) <60 mL/min/1.73m2 as calculated by the CKD-EPI creatinine equation (2009) for adults and by the Schwartz creatinine equation for adolescents (2009). MDRD can be used for adults per local recommendations. 11. Presence of any clinically significant disease or laboratory abnormality which, in the opinion of the Investigator, can interfere with the study objectives and/or safety of the subjects. 12. Female subjects who are pregnant, lactating, or intending to become pregnant during the study. 13. Treatment with phototherapy or afamelanotide within 3 months before baseline (Visit 2). 14. Treatment with cimetidine or antioxidant agents at doses which, in the opinion of the Investigator, may affect study endpoints (including but not limited to beta-carotene, cysteine, pyridoxine) within 4 weeks before baseline (Visit 2). 15. Chronic treatment with any scheduled analgesic agents including, but not limited to opioids and opioid derivatives such as morphine, hydrocodone, oxycodone, fentanyl, or their combination with other unscheduled analgesics or non-steroidal anti-inflammatory drug (Percocet and Vicodin-like prescription drugs) within 4 weeks before baseline (Visit 2). Acute use of scheduled narcotics greater than 3 months prior to baseline, over-the-counter medications (OTCs), such as non-steroidal anti-inflammatory drugs (NSAIDs) or aspirin for analgesia, or prior temporary use of scheduled agents within 3 months of baseline (Visit 2) are not excluded. 16. Treatment with any drugs or supplements which, in the opinion of the Investigator, can interfere with the objectives of the study or safety of the subjects. 17. Previous treatment with any investigational agent other than dersimelagon within 12 weeks before Screening OR 5 half-lives of the investigational product (whichever is longer).