Does the GM have to know all the rules of a game system?
That is right. You don't have to know all the rules. Trust me when I say that your players would rather play with a GM who does not know all the rules than Wait a few months for a GM to memorize every spell, sub game system (Like Shadowrun Deckers). Players are more forgiving than you think when it comes to rules as long as the GM is fair when it comes to rulings.
Here are a few tricks to learning a new game system.
Get to know the core mechanic by heart.
Getting to know the core mechanic of a system is very important. As a GM if you can get this one part down everything else is simple. If nothing else knowing the core rules will allow you to make decisions on how a player should resolve casting a spell or how to jump over that Ork that came out of nowhere. Basically, the Core rules fill in the gaps that the combat, Magic & Hacking rule sets do not cover. In most game systems if you know the core rules you already know 70% of the combat system.
You can't know it all. We are not computers. So take notes. That is what your GM screen is for. Make notes for those complex systems that you always forget. Write down the target numbers needed to make that saving throw vs poison.
So just the other day I ran Numenera for the first time. I was very clear with my players that I had not run the game before and that I did not know the rules. Setting the expectations with the players does two things. First, it lets the players know that you are going to make mistakes and they are going to have to be ok with it. Second, it makes it ok in your mind to not be perfect. It's ok to make mistakes
Make Rulings vs looking everything up.
The Game must go on. Avoid looking up the rules during the game. So if something new comes up make a ruling based on what makes the most sense vs hunting 20 min for the exact rule (that may or may not exist). when you make a ruling on a rule that you are unsure of it's important to let the players know "I'm making this ruling one time because I want to keep the game going. we can look up the exact rules after the game for the next time this comes up". I have rarely had a player protest this (Rules lawyers are an exception because they always argue the rules)