You can install OptiFine without also manually installing Java on macOS or Windows. It involves the command line but the process is very easy. On Windows and macOS, Minecraft Java Edition bundles and manages its own Java installation. We can use this Java to run the .jar OptiFine installer.
Part 1: Locate Minecraft's Java
On macOS, the bundled Java runtime is located inside theminecraft/runtime/jre-x64
folder. On Windows, it is located
inside the Launcher's Program Files folder at Minecraft Launcher\runtime\jre-x64
for 64-bit computers, and
Minecraft Launcher\runtime\jre-x86
for 32-bit computers.
If you installed Minecraft in the default locations, the full path to the Java executable is:
-
macOS:
~/Library/Application\ Support/minecraft/runtime/java-runtime-gamma/mac-os/java-runtime-gamma/jre.bundle/Contents/Home/bin/java
-
Windows 64-bit via Windows Store:
\Users\YourUser\AppData\Local\Packages\Microsoft.4297127D64EC6_8wekyb3d8bbwe\LocalCache\Local\runtime\jre-legacy\windows-x64\jre-legacy\bin\java.exe
-
Windows 64-bit Legacy Launcher:
\Program Files (x86)\Minecraft Launcher\runtime\jre-x64\bin\java.exe
-
Windows 32-bit Legacy Launcher:
\Program Files (x86)\Minecraft Launcher\runtime\jre-x86\bin\java.exe
Part 2: Invoke Minecraft's Java
You can run .jar files from the command line using the following command format:java -jar path/to/program.jar
. However, if you
tried this on your computer without Java manually installed, the command will fail. This is because your computer does not know where to find the
java
command, so we will need to use the full path to Minecraft's Java.
Using the aforementioned command format, we can run the OptiFine installer using the following steps.
-
Open your operating system's command line interface.
On macOS, this is Terminal, and you can find it by going to/Applications/Utilities
in the Finder and launching Terminal, or by searching for "Terminal" (without quotes) in Spotlight.
On Windows, this is CMD, and you can find it by searching for "CMD" (without quotes) in the start-menu or taskbar search field. -
Enter the path to Java, which you found in Part 1.
You will need to ensure special characters like spaces are properly escaped. On macOS, simply place a backslash (\
) before every space in your path, or surround the entire path in quotes. On Windows, surround the entire path in quotes. -
Add
-jar
to the path in your command window. There should be a space between your path and the -, and after the r. - Find your OptiFine installer .jar file, and drag it on top of the command window. It should autofill the path.
- Press Enter to run the command. You should see the OptiFine installer window appear. Run it and play Minecraft!
-
macOS:
~/Library/Application\ Support/minecraft/runtime/java-runtime-gamma/mac-os/java-runtime-gamma/jre.bundle/Contents/Home/bin/java -jar /users/your\ user/Downloads/OptiFine_1.14.4_HD_U_F5.jar
-
Windows 64 bit Legacy Launcher:
"\Program Files (x86)\Minecraft Launcher\runtime\jre-x64\bin\java.exe" -jar "C:\Users\your user\Downloads\OptiFine_1.14.4_HD_U_F5.jar
If you want, you can add Minecraft's Java to your PATH environment variable so that you only need to type
java -jar path/to/OptiFine_1.XX.X_HD_X_XX.jar
.
Search the internet for (without quotes) "add environment variable macOS" or "add environment variable Windows" to get guides about how to do this.