I can't help with the optifine issue unless I see a crash log. They are working when installed correctly.

Realm error is unrelated. I have confirmed that Realms are working, so try again on your end. It can take a little to load.