Download the OptiFine `.jar` file from the official OptiFine website
Make sure Minecraft Java Edition is installed
Open the downloaded OptiFine `.jar` file
Click `Install`
Open the Minecraft Launcher
Select the OptiFine profile
Click `Play`
If the installer does not open, install Java first
If needed, place the OptiFine `.jar` file in your Minecraft `mods` folder and use a compatible mod loader only if required by your setup
