Inclusion Criteria:  Provide signed informed consent which includes pharmacogenomic (PGx) testing. Have a diagnosis of MDD without psychotic features, according to the Diagnostic and Statistical Manual of Mental Disorders, 5th Edition (DSM-5) criteria, based on clinical assessment and confirmed by the Mini International Neuropsychiatric Interview (MINI).  Have a history of TRD within the past 5 years as documented by the Massachusetts General Hospital (MGH) Antidepressant Treatment Response Questionnaire (ATRQ) (5-year version). That is, within the past 5 years study participants must have had a clinically meaningful inadequate response (estimated < 50% improvement per Investigator/patient consensus and documented by the Investigator) to at least two treatment courses with antidepressant regimens. These must involve at least two different pharmacologic treatment classes* and have been given at accepted therapeutic doses for an adequate duration (at least 6 weeks). One of these treatment failures must have occurred within the current episode.  *Note: Augmentation with an approved agent (eg, quetiapine or aripiprazole) for at least 6 weeks can be considered to be a separate failed treatment course. Documentation may be by notes from the treating clinician (documented, dated oral report is acceptable) or pharmacy records. Reports from a prior clinical trial are NOT adequate.  To be eligible, patients may be either genotype GG for DGM4 (DGM4 positive) or genotype AA or AG for DGM4 (DGM4 negative), however most DGM4 negative patients (~85%) will be randomly excluded by an IRT system in order to achieve the appropriate randomization ratio of DGM4 positive vs negative patients.  Pregnancy conception limitations  Female patients must be postmenopausal or surgically sterile or, if of childbearing potential and the partner is not vasectomized (6 months minimum), must agree to use a medically acceptable form of contraception from the time of signing the informed consent form through at least 60 days following the last administration of study drug. If only the barrier method is used, a double barrier must be employed. Postmenopausal women must have had ≥ 24 months of spontaneous amenorrhea. Surgically sterile women are defined as those who have had a hysterectomy, bilateral ovariectomy, or bilateral tubal ligation. All women of childbearing potential must have a negative pregnancy test result before administration of study drug. Male patients must be biologically incapable of having children (eg, vasectomized) or must agree to use the above forms of birth control for themselves and their partner from the time of signing the informed consent form through at least 120 days following the last administration of study drug. Be fluent in the local language. Male or female aged 18 to 70, inclusive, at time of enrollment. Have a HAMD-17 total score ≥ 21 at screening. Be willing to discontinue the use of antidepressants at least 2 weeks prior to baseline (Day -1). For fluoxetine, a washout period of at least 3 weeks for ≤ 20 mg/day and at least 4 weeks for > 20 mg/day is required.  Exclusion Criteria:  Prior participation in a study with liafensine Used any investigational drug product, device, or biologic within 6 months or five half-lives (whichever is longer) prior to baseline (Day -1). A positive pregnancy test result or currently breastfeeding. Clinically significant illness (including chronic, persistent, or acute infection), medical/surgical procedure, or trauma within 30 days prior to screening or between screening and baseline (Day 1) as determined by the investigator. A history or presence of a clinically significant hepatic, renal, gastrointestinal, cardiovascular, endocrine, respiratory, immunologic, hematologic, dermatologic, or neurologic abnormality, or any other condition, that in the investigator's opinion, represent potential risk to the patient's safety, full participation in the study, or affect the absorption, distribution, metabolism, or excretion of liafensine. Autoimmune hepatitis, primary sclerosing cholangitis, untreated hepatitis C, active hepatitis B, or any other uncontrolled or unstable liver disease. One or more clinical laboratory evaluations are outside the reference range, at screening, that are in the investigator's opinion, of potential risk to the patient's safety  Has at the Screening Visit:  Alanine aminotransferase (ALT) or aspartate aminotransferase (AST) levels > 1.5x the upper limit of normal (ULN) at screening. Total bilirubin > 2 mg/dL (34.2 µmol/L) at screening, unless there is an explained indirect hyperbilirubinemia, eg, Gilbert's syndrome. Alkaline phosphatase > 1.5x the ULN at screening. Note: Laboratory tests can be repeated to see if values return to within range, but any such laboratory abnormality must be resolved by the Baseline Visit. Clinically significant vital signs abnormality at screening. This includes, but is not limited to, the following, in the supine position (after at least 5 minutes supine-controlled rest): systolic blood pressure > 150 mmHg; diastolic blood pressure > 95 mmHg; or heart rate < 50 or > 90 beats per minute. Corrected QT interval measurement corrected according to the Fridericia rule (QTcF) > 450 msec for men and > 470 msec for women during controlled rest at screening, or history of long-QT syndrome.  ECGs containing any of the following readings:  Left bundle branch block or; Right bundle branch block with QRS duration > 140 ms or; Intraventricular conduction defect with QRS duration > 140 ms or; Long QT syndrome. History of seizure, other than childhood febrile seizures. History of clinically significant head trauma, including closed head injury with loss of consciousness, that is, in the opinion of the investigator, likely to affect central nervous system functioning. History of clinically significant symptomatic orthostatic hypotension (ie, postural syncope). History of narrow angle glaucoma. History of cancer within 2 years prior to screening or between screening and baseline (Day 1), except for non-metastatic basal and/or squamous cell carcinoma of the skin. Use of prescription or nonprescription medications for attention-deficit hyperactivity disorder (ADHD), narcolepsy, or cognitive enhancement (eg, methylphenidate, atomoxetine, modafinil, ginkgo biloba, and huperzine A) within 30 days prior to screening or between screening and baseline (Day -1). Regular consumption of (eg, more days than not) excessive quantities of xanthine-containing beverages (eg, more than five cups of coffee or the equivalent per day) within 30 days prior to screening or between screening and baseline (Day -1). Urine drug screen (UDS) positive for a drug of abuse, with the exception of cannabis in countries where it is legally available (see Table 3 for list of drugs of abuse). Where legal, prior use of cannabis is permitted provided the patient agrees to abstain from smoking or ingesting cannabis or cannabis products during the study and provided that, in the judgement of the investigator, any use of these products is unlikely to interfere with the patient's compliance with any of the study procedures or the investigator's interpretation of study results. Use of psychopharmacologic drugs (including antidepressants and over-the-counter medications to treat depression [eg, St John's Wort]) within 2 weeks or 5 half-lives, whichever is longer, prior to baseline (Day -1). For fluoxetine, a washout period of at least 3 weeks for ≤ 20 mg/day and at least 4 weeks for > 20 mg/day is required. Use of highly protein bound drugs (eg, doxycycline, digoxin, phenytoin, or furosemide) within 2 weeks prior to baseline (Day -1). Current diagnosis or history of a psychotic disorder, MDD with psychotic features, manic or hypomanic episode of bipolar or related disorders, post traumatic stress disorder, obsessive-compulsive disorder (if primary), intellectual disability (DSM-5 diagnostic code 319), borderline personality disorder, antisocial personality disorder, histrionic personality disorder, or narcissistic personality disorder, according to the DSM-5 criteria, or any other psychiatric or neurologic disorder or symptom due to a general medical condition, that, in the judgement of the investigator, could pose undue risk to the patient or compromise the study. Moderate or severe alcohol use disorder or other substance use disorder (except nicotine or caffeine), within 6 months prior to screening, according to the DSM-5 criteria.  Significant risk of suicide according to the C-SSRS or has a score ≥ 5 on Item 10 (suicidal thoughts) of the MADRS at screening or baseline (Day -1), or has attempted suicide within 6 months prior to the initial Screening Visit.  Acute suicidality as evidenced by answering "yes" for Question 4 ("In the Past Year") or Question 5 ("In the Past Year") on the C-SSRS, indicating active suicidal ideation with any intent to act, at screening, Day -14, or baseline (Day -1). History of suicidal behavior such that a determination of "yes" is made on the Suicidal Behavior section of the C-SSRS ("In the Past Year") for "Actual Attempt," "Interrupted Attempt," "Aborted Attempt," or "Preparatory Acts or Behavior." Previous allogenic bone marrow transplant. Received non-leukocyte-depleted whole blood transfusion within 4 months prior to PGx testing at Screening.