The swiss army knife for Magento developers, providing a huge set of well tested command line commands which save hours of work time. If your developing Magento sites this is a must have addition for your toolbox.
Logging into the Magento admin area to perform some simple tasks is very time consuming, if your already familiar with the command prompt this is a much better approach.
Today I’m going to show you how to install the tool, you can also find all the information you’ll need from their GitHub repo and the Magerun website. Before I start I’m going to assume you have a basic understanding of the command prompt, if you haven’t I’d recommend you brush up on your commands before proceeding.
How to install
Download the latest stable N98-Magerun phar-file from the file-server:
wget http://files.magerun.net/n98-magerun-latest.phar -O n98-magerun.phar
Make the phar-file executable:
chmod +x ./n98-magerun.phar
The base-installation is now complete and you can verify it:
./n98-magerun.phar --version
The command should execute successfully and show you the version number like:
n98-magerun version 1.97.0 by netz98 new media GmbH
You now have successfully installed Magerun!
Installing system wide
You can tailor the installation further by installing it system-wide by copying the file to /usr/local/bin
. This will allow you to use the tool from any Magento installation, you won’t have to install Magerun for each Magento install:
sudo cp ./n98-magerun.phar /usr/local/bin/
Creating an alias
To use Magerun you simply type in n98-magerun.phar
into the command prompt which will show you a list of all the available commands. If your like me and your finding it to be a bit lengthy to type each time you want to use it, creating an alias will be the answer.
Within your root directory /Users/{your-username}
you’ll find a file called .bash_profile
. If this file doesn’t exist go ahead and create it by typing in touch .bash_profile
and then add the following line:
alias magerun='n98-magerun.phar'
Now when you type in magerun
it will run the command just like it did previously.
Updating Magerun
To update to the latest version please run:
n98-magerun.phar self-update
If your running into any difficulty with the installation please leave your comments below.