Magento 2: How to install and configure n98-magerun2 tool globally?

How to install and configure n98-magerun2 tool globally?

Hello Devs, In today’s tutorial we are going to see how to install and configure the 98-magerun2 tool globally. Using this installation method you can use this tool in your all local Magento projects.

For Magento 2 developers, there are a lot of tools available for developers to perform some operations which are very useful during the development and debugging time.

The n98 magerun CLI Tool provides some handy tools to work with Magento / Mage-OS / Adobe Commerce from the command line.

So, Let’s get started.

Step 1: Go to your home directory first

You can run only the “cd” command to go to your user directory in your ubuntu instance from anywhere.

Run the cd command and check the output.

Step 2: Download and Install Phar File

Download the latest stable n98-magerun phar-file using the below command.

You can also download using the curl command using “CURL” request.

Type and hit command in terminal :

Step 3: Make the phar-file executable:

It is important to make this phar file executable first, so you can execute commands using this file.

To make this downloaded file executable in your system, run the below command in the terminal.

Step 4: Verify the installation

To verify that the file is executable, run the below command in the terminal.

It will output the phar file version of this tool like below. If it prints the version without any errors, it means installation is now successfully completed.

Step 5: Make installation globally to run system-wide

You don’t need to install it separately for all projects, you can simply make it system-wide accessible by moving it to the /usr/local/bin/ directory using the below command.

Once you hit the above command in the terminal, It will copy the file to the specified folder.

Step 6: Use the tool in your project

Simply navigate to your project root directory, where your Magento 2 is installed.

For example,

Now you can run “n98-magerun2.phar” command from here, It will list all commands available to use using n98-magerun2 CLI tool.

It will print all the available commands, but if you will check it will list all magento 2 built-in commands and n98-magerun2 commands together.

You can run the below command to list only n98-magerun2 tool commands.

You may also like :

How to configure Magento 2 coding standards in visual studio code?

That’s it for this tutorial, See you in the next blog. Thank You 🙂

Leave a Reply

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