diff --git a/bin/minus-x.php b/bin/minus-x.php
index <HASH>..<HASH> 100755
--- a/bin/minus-x.php
+++ b/bin/minus-x.php
@@ -20,7 +20,25 @@
  * @file
  */
 
-require_once __DIR__ . '/../vendor/autoload.php';
+// This file can be located in ./bin/minus-x.php
+// or ./vendor/mediawiki/minus-x/bin/minus-x.php
+$autoload = [
+	__DIR__ . '/../../../../vendor/autoload.php',
+	__DIR__ . '/../vendor/autoload.php',
+];
+$found = false;
+foreach ( $autoload as $file ) {
+	if ( file_exists( $file ) ) {
+		require_once $file;
+		$found = true;
+		break;
+	}
+}
+
+if ( !$found ) {
+	echo "Error, unable to find composer autoloader.\n";
+	die( 1 );
+}
 
 use MediaWiki\MinusX\CheckCommand;
 use MediaWiki\MinusX\FixCommand;
Fix finding autoloader in minus-x.php

When installed as a package, the autoloader is in a different location
relative to minus-x.php.

Change-Id: I<I>e<I>f7aeaf<I>f<I>f<I>a<I>ee