diff --git a/src/nl/hannahsten/texifyidea/run/makeindex/MakeindexCommandLineState.kt b/src/nl/hannahsten/texifyidea/run/makeindex/MakeindexCommandLineState.kt
index 0d1a29b82..c764efb30 100644
--- a/src/nl/hannahsten/texifyidea/run/makeindex/MakeindexCommandLineState.kt
+++ b/src/nl/hannahsten/texifyidea/run/makeindex/MakeindexCommandLineState.kt
@@ -37,7 +37,10 @@ class MakeindexCommandLineState(
 
         val command = ParametersListUtil.parse(commandLineArguments ?: "").apply {
             add(0, indexProgram.executableName)
-            add(indexFilename)
+            // The -o parameter overrides the output file name, so then we shouldn't append it a second time
+            if (commandLineArguments == null || commandLineArguments.contains("-o").not()) {
+                add(indexFilename)
+            }
         }
         val commandLine = GeneralCommandLine(command).withWorkDirectory(workingDirectory?.path)