Categories


Archives


Recent Posts


Categories


Magento Connect Command Line Tool

astorm

Frustrated by Magento? Then you’ll love Commerce Bug, the must have debugging extension for anyone using Magento. Whether you’re just starting out or you’re a seasoned pro, Commerce Bug will save you and your team hours everyday. Grab a copy and start working with Magento instead of against it.

Updated for Magento 2! No Frills Magento Layout is the only Magento front end book you'll ever need. Get your copy today!

While you’re probably familiar with the Magento Connect GUI, Magento CE also ships with a command line program for managing your packages. If you’re a developer, you’ll probably prefer using this tool to install a Connect package, if only because you won’t run into the plethora of permissions problems with web based GUI that needs to write out files to the underlying system.

The CLI tool, named mage, is located at the root of your Magento file system. Run it to get a list of commands

$ ./mage
Connect commands available:
===========================
channel-add          Add a Channel       
channel-alias        Specify an alias to a channel name
channel-delete       Remove a Channel From the List
channel-info         Retrieve Information on a Channel
channel-login        Connects and authenticates to remote channel server
channel-logout       Logs out from the remote channel server
clear-cache          Clear Web Services Cache
config-get           Show One Setting    
config-help          Show Information About Setting
config-set           Change Setting      
config-show          Show All Settings   
convert              Convert old magento PEAR package to new format
download             Download Package    
info                 Display information about a package
install              Install Package     
install-file         Install Package Archive File
list-available       List Available Packages
list-channels        List Available Channels
list-files           List Files In Installed Package
list-installed       List Installed Packages In The Default Channel
list-upgrades        List Available Upgrades
package              Build Package       
package-dependencies Show package dependencies
package-prepare      Show installation information of package
sync                 Synchronize Manually Installed Packages
sync-pear            Synchronize already Installed Packages by pear
uninstall            Un-install Package  
upgrade              Upgrade Package     
upgrade-all          Upgrade All Packages

If you get a Permission denied error, don’t forget you’ll need to execute permissions on the command line scripts

$ chmod +x mage

Also, less obviously, if you try to install a package right away, you’ll probably get an error something like this

$ ./mage install-file ~/Downloads/Nexcessdemo_Commercebug-2.0.0/Nexcessdemo_Commercebug-2.0.0.tgz
install-file: The 'community' channel is not installed. Please use the MAGE shell script to install the 'community' channel.

$ ./mage install community Layout_Unremove
install: Couldn't resolve host 'community'

Without going too deep into the details, the Magento Connect CLI needs to be initialized before it can be used. Fortunately, initialization is as simple as running the following command

$ ./mage mage-setup
Running initial setup...
Success
Success
Successfully added: http://connect20.magentocommerce.com/community

After that you’ll be good to go.

Copyright © Alana Storm 1975 – 2023 All Rights Reserved

Originally Posted: 6th February 2013

email hidden; JavaScript is required