I am installing a few modules one by one into my magento 2 application. Can we enable all modules in the same namespace with one command?

Right now I am using:

php bin/magento module:enable Vendor_MyModule1
php bin/magento module:enable Vendor_MyModule2
php bin/magento module:enable Vendor_MyModule3

Is there a way I can do this with a wildcard?

php bin/magento module:enable Vendor_*

5 Answers 5


You cannot use wildcards but you can enable all of them from one command like this:

php bin/magento module:enable Vendor_MyModule1 Vendor_MyModule2 Vendor_MyModule3
  • this is definitely an improvement Jun 23, 2016 at 13:41

Short answer: Yes, you can.

But it is *nix command trick, Magento 2 does not support it by default as Marius answer.

You can execute the following command and it can do what you want.

php bin/magento module:status | grep VendorName_ | grep -v List | grep -v None | grep -v -e '^$'| xargs php bin/magento module:enable



You can use the the --all flag to enable all available modules

 php bin/magento module:enable --all

This of course is if you don't mind enabling all modules. Tested in magento 2.1.x

  • Might be the way to go ... if you want to enable "most" then you can exec this ... then run Disable whta you dont need before you hit upgrade
    – snh_nl
    Apr 23, 2019 at 11:56

In case you have copied an entire namespace directory(ies) and want Magento to install all those at one shot then do the following :

php bin/magento setup:upgrade

This way you don't have to mention all modules names.

  • This is just perfect if you want to install magento with a lot of custom modules on a empty database. _<sequence> _ is just so bad with that... Sep 6, 2017 at 13:56
  • php bin/magento setup:upgrade this won't enable any previously disabled module. setup:upgrade is required after placing extensions dir. So first the extension has to be in app/code/ and then enabling these extensions by module:enable then lastly running module:enable Jul 24, 2018 at 16:10

Another way would be:

  • Open app/etc/config.php
  • That file returns an array of modules with the module name as key and 1 or 0 as value.
    • 1 indicates enabled
    • 0 indicates disabled
  • You can find the modules that you want to disable and set their respective value to 0.
  • Here's an example:

    return [
        'modules' => [
            'Vendor_MyModule1' => 0,
            'Vendor_MyModule2' => 0,
            'Vendor_MyModule3' => 0,
  • After that, open terminal and go to your magento root directory.

    cd /path/to/your/magento/root/folder
  • Finally, run setup upgrade command:

    php bin/magento setup:upgrade
  • i will recommend @Toan Nguyen answer.
    – Ali Raza
    Jul 29, 2021 at 12:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.