Yes, you do file a tax return for Massachusetts. You are filing a return as a nonresident since you don't live there, and you allocate your income to Massachusetts by determining how much you earned there, whether by actual amounts, or, in this case, by percentages (which is also acceptable).
California also does tax this income; however, California will give you a credit for the amount of tax you pay on this same income to Massachusetts so that you are not over-taxed. If the Massachusetts tax on that income is equal to or greater than what the California tax would be, then you pay no additional tax. If the California tax is greater, you would pay the difference (only on the income earned in MA. CA will obviously tax you on the rest of the income).
Because of this, and so that TurboTax calculates the credit correctly, you will want to prepare the Massachusetts return first. Here is an FAQ to assist with this: https://ttlc.intuit.com/replies/3302052
**Say "Thanks" by clicking the thumb icon in a post
**Mark the post that answers your question by clicking on "Mark as Best Answer"