Magento – Installing Extensions via Command Line


I don’t like the idea of having to change permissions of my magento install to add on new extensions. There’re some services that allow you to download extension in compressed file like , so you will only need to extract then copy&paste to your Magento installation folder, this is also a pain to me, especially when i’m on a Mac (yes, Mac is bad at merging files) . Thanks to Magento, we have command line for this type of work.

So here is how to do via Terminal (shell, ssh, or whatever …). Make sure you know how to use terminal and type command properly .

Firstly, navigate to base magento directory

cd /path/to/your/magento/directory

Then you may need to install connect20 community channel

./mage mage-setup
./mage -V
./mage list-channels

From this point, we have 2 options to install extension, locally or via community channel

./mage install <channelName> <packageName>
# install using compressed extension
./mage install-file <path/to/file>

for example

# install from channel
./mage install Nexcessnet_Turpentine
# install locally
./mage install-file ~/Downloads/Ves_MiniCart-1.1.0.tgz

You can get packageName by clicking on ‘Install now’ button, then get extension key of Magento Connect 2.0, you will have a url like this :
Package name is last part of URL, in this case we have Nexcessnet_Turpentine

Finally, you should do a chown -R on your directories to whatever your’s is (visit this post) , otherwise they may have root:root

I was running this on magento 1.6 using version 2.0 of magento connect to get the extension info.