Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk4 min

How to Run Magento CLI Commands with n98-magerun2

A practical guide to installing n98-magerun2, running commands, checking compatibility, and targeting the right Magento 2 project.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To run an n98-magerun2 command, install the PHAR or Composer distribution, use its executable with the command name, and confirm the Magento root before making changes. n98-magerun2 is a separate utility for Magento 2, Mage-OS, and Adobe Commerce; Adobe Commerce’s built-in CLI is <magento_root>/bin/magento. Use the executable that provides the command you need.

Check platform and PHP compatibility first

n98-magerun2 is for modern Magento-based platforms, not Magento 1 or OpenMage. Its original companion tool, n98-magerun, is intended for Magento 1. The project describes n98-magerun2 as supporting “modern Magento-based platforms.” See the official project repository and its Introduction documentation.

As an Amazon Associate I earn from qualifying purchases.

Compatibility depends on the n98-magerun2 release, platform version, and PHP version. The current compatibility matrix lists n98-magerun2 v9.0.0 or later for Adobe Commerce/Magento Open Source 2.4.8+ and Mage-OS 1.2.x+. It specifies PHP 8.2 as the minimum for n98-magerun2 v10.0.0 and later. Check the matrix for your exact combination before installing; support changes across releases. Windows is not fully supported, and some commands, including db:dump and install, may be unavailable there.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

As of October 4, 2026, the project’s release page lists 10.0.2, released August 27, 2026, as the latest release. Check the release page when choosing a version, since that status can change.

Install n98-magerun2

Recommended for daily use: download the PHAR

The official installation guide favors the PHAR for routine use. From a directory where you want to store it, download the file and its SHA-256 checksum, verify it, then make it executable:

curl -sS -O https://files.magerun.net/n98-magerun2.phar
curl -sS -o n98-magerun2.phar.sha256 'https://files.magerun.net/sha256.php?file=n98-magerun2.phar'
shasum -a 256 -c n98-magerun2.phar.sha256
chmod +x ./n98-magerun2.phar
./n98-magerun2.phar --version

The checksum command should report that the PHAR is OK. If your system does not have shasum, use a SHA-256 verification tool available for your operating system and compare its result with the checksum file. Follow the official installation instructions for manual verification or placing the PHAR in a directory on your PATH, such as /usr/local/bin.

Composer distribution

For a project-local installation, run this from the Magento project directory:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
composer require n98/magerun2-dist

Invoke that installation as ./vendor/bin/n98-magerun2.phar. For a global Composer installation, use composer global require n98/magerun2-dist and ensure Composer’s global binary directory (the documentation gives ~/.composer/vendor/bin) is on your PATH.

The project documentation warns that installing the source package with composer require n98/n98-magerun2 is not recommended for daily use: it cannot guarantee compatibility with every project and Magento core dependency. Prefer the PHAR or the n98/magerun2-dist package unless you have a specific development reason to use the source package.

Run a command and find its options

With the downloaded PHAR, run it from the Magento root or provide the root explicitly. These examples list available commands, run a cache operation, and show that command’s options:

./n98-magerun2.phar list
./n98-magerun2.phar cache:clean
./n98-magerun2.phar cache:clean --help

If the PHAR is not executable, call it through PHP instead:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
php n98-magerun2.phar list
php n98-magerun2.phar <command> --help

For a Composer project install, replace ./n98-magerun2.phar with ./vendor/bin/n98-magerun2.phar. Use list to discover what the installed version exposes, then run <command> --help for that command’s syntax. Do not assume options are shared between different command families.

Target the intended Magento installation

n98-magerun2 attempts to identify the Magento root from its context. When you run it outside the project directory, or want to remove any ambiguity, set the global --root-dir option to the actual Magento root:

./n98-magerun2.phar --root-dir=/var/www/store list
./n98-magerun2.phar --root-dir=/var/www/store cache:clean

Replace /var/www/store with the directory for the installation you intend to manage. Confirm the path before running commands that modify configuration, cache, indexes, or the database. The global help and version switches are also useful for checking the invocation:

./n98-magerun2.phar --help
./n98-magerun2.phar --version

The global options include --skip-config and --skip-root-check as well. These change how the tool handles configuration or root validation; they do not make an incorrect project path safe. Avoid bypassing checks unless you understand why they are blocking the operation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choose n98-magerun2 or Adobe’s built-in CLI

Adobe Commerce has its own CLI at <magento_root>/bin/magento. It is not an alias for n98-magerun2, and n98-magerun2 does not replace it. Identify which tool documents the command you want, then invoke that tool:

Need Executable How to discover commands
An n98-magerun2 command ./n98-magerun2.phar <command> (or the Composer path) ./n98-magerun2.phar list, then <command> --help
A built-in Adobe Commerce command <magento_root>/bin/magento <command> <magento_root>/bin/magento list

n98-magerun2’s command reference includes examples such as cache:clean, cache:flush, config:store:get, config:store:set, db:dump, db:import, db:query, indexer:list, sys:info, and script. Availability can depend on the installed release and environment; check list and the command’s help rather than treating this as a universal inventory. The official command reference groups commands by namespace.

Run commands with the right permissions

Adobe’s guidance says to run Commerce CLI commands as a file-system owner with write permission. Use the ownership and deployment conventions for your installation rather than defaulting to root. For production work, follow the site’s backup and change-control procedures, especially for database imports or configuration changes. A root-check bypass is not a substitute for correct ownership or a verified target path. See Adobe’s CLI reference.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.