Install HomeBrew on the Mac. Then install an X server on both Mac and Ubuntu. After that, you can use SSH with X forwarding between them.