Spend a total of more than 183 days of the tax year in Massachusetts, including days spent partially in Massachusetts. (Do not count days spent in Massachusetts while on active duty in the U.S. armed forces.)
https://www.mass.gov/info-details/legal-and-residency-status-in-massachusetts