I live in MA but sold a gift property in CA, how do I file state taxes

Hi!

I was gifted a home, and sold it immediately (so I know I don't qualify for the capital gains exclusion) in CA. I filed for a FTB CA withholding. I live and work in MA. So I know that I have to claim the house sale on my federal taxes, but do I also file a nonresident for CA for the property sale income and report the withheld tax, and then resident for MA and include the property sale income as earned income?