Published: April 21, 2015
Last updated:

How to check Magento version in shell / console

When you are working on several Magento installations you may need to determine version of every Magento site without going to Backend (it is shown at bottom of every page in Backend) or looking down through contents of app/Mage.php (it is in content of getVersionInfo function). I use this simple shell command line to check Magento version (when under Magento root directory):

$ grep -A6 'static function getVersionInfo' app/Mage.php
    public static function getVersionInfo()
    {
        return array(
            'major'     => '1',
            'minor'     => '9',
            'revision'  => '1',
            'patch'     => '0',

As you can see in the example above it is Magento 1.9.1.0. Another option can be to use built-in ./mage command and search for Mage_All_Latest or Mage_Core_Modules (sometimes you may need to issue ./mage sync first to import packages installed in some other way):
./mage list-installed|egrep "Mage_All_Latest|Mage_Core_Modules"
Mage_All_Latest      1.9.1.0 stable      
Mage_Core_Modules    1.9.1.0 stable      
Without grep it will just list all installed packages for detailed verification:
$ ./mage list-installed
Installed package for channel 'community' :
Interface_Adminhtml_Default 1.9.1.0 stable      
Interface_Frontend_Base_Default 1.9.1.0 stable      
Interface_Frontend_Default 1.9.1.0 stable      
Interface_Frontend_Rwd_Default 1.9.1.0 stable      
Interface_Install_Default 1.9.1.0 stable      
Lib_Cm               1.8.0.0 stable      
Lib_Credis           1.8.0.0 stable      
Lib_Google_Checkout  1.9.1.0 stable      
Lib_Js_Calendar      1.51.1.1 stable     
Lib_Js_Ext           1.7.0.0 stable      
Lib_Js_Mage          1.9.1.0 stable      
Lib_Js_Prototype     1.7.0.0.5 stable    
Lib_Js_TinyMCE       3.5.11.0 stable     
Lib_LinLibertineFont 2.8.14.1 stable     
Lib_Mage             1.9.1.0 stable      
Lib_Magento          1.9.1.0 stable      
Lib_Pelago           1.9.1.0 stable      
Lib_Phpseclib        1.5.0.0 stable      
Lib_Varien           1.9.1.0 stable      
Lib_ZF               1.12.7.0 stable     
Lib_ZF_Locale        1.12.7.0 stable     
Mage_All_Latest      1.9.1.0 stable      
Mage_Centinel        1.9.1.0 stable      
Mage_Compiler        1.9.1.0 stable      
Mage_Core_Adminhtml  1.9.1.0 stable      
Mage_Core_Modules    1.9.1.0 stable      
Mage_Downloader      1.9.1.0 stable      
Mage_Locale_en_US    1.9.1.0 stable      
Magento_Mobile       1.9.1.0 stable      
Phoenix_Moneybookers 1.3.2.1 stable     
Another option (for scripting) can be to lookup it by fingerprint:
$ md5sum app/Mage.php
455107edad0b3df3e427fd9f9711c3cd  app/Mage.php
It outputs MD5 fingerprint of app/Mage.php file which is specific for every Magento version (as it contains Magento version itself) and I lookup it in the table (which I prepared by adding every unknown fingerprint line by line, day by day): (use search at the top right of the table to filter results)
MD5 hash of app/Mage.php Corresponding Magento version
04648d84079d128da03d04682824f4e61.6.2.0
1b925ee02d89273851bf07f982ff0af51.8.1.0
1cf6669f8d30d639b48ba66c662517551.6.2.0
23e6dc9f9fdc9e16b6325054faa6edfd1.5.0.1
245d42c31b5300453df5ae3826e852481.5.0.1
2df0a31ec93306d35b5cf7ee54ef14301.5.1.0rc1
3764ef2d38069630afc512623993ae451.7.0.2
455107edad0b3df3e427fd9f9711c3cd1.9.1.0
48a8188d1cdb1101e22f7f729b49d2d81.8.0.0
4d3d4da7886883e3f74bb45a8b9496601.5.1.0
574a35a457ac0a8ea3d2fba23d7bf2cb1.6.0.0
5f73fc5d1f2beaa1b257127015b113651.4.1.0
8bbc0c801bf1fa68a05647acb18fe5781.4.1.1
8c5802a934d2287c56de487e85d2bc4d1.9.0.0
aa89db65888eb78f1d952eb2c430166e1.7.0.1
b65c8c09cd47e84ffdbf590f8c7c85f01.8.1.0
c45505c0a808e8afa37d93aa00de3fd11.9.0.1
cad51ef96b0401ae0544f8824c7947e71.4.0.1
d47043a140aabd61aac1b4bbfbac803d1.6.1.0
db636924cb65b2f58f988df0791ed1391.5.1.0
5f73fc5d1f2beaa1b257127015b113651.4.1.0
f77f7731c143abb2a11b823f13e51ba11.4.2.0

Posted in: Magento Maintenance

63 votes, 4.60 avg. rating (91% score)