Switching paths very late
First of all, don't be too worried, switching after the Bachelors is not "very late" and happens more often than you seem to think.

Now for your question: I would first try to find a university/program you like to join. Maybe even more than one, in case that you don't get into your first choice.

Then, you should contact the advisor(s) responsible for this program and ask them your questions. The requirements are a little different for every program, some offer the chance to catch up on missing courses during the program, others require it before the program or don't offer it at all. Thus, we can't really give you a general answer here, as every program handles things a little different. But, as I said in the beginning, it is not entirely uncommon for students to switch paths, so most program advisors should be familiar with such cases.