Sarathlal N

Switch Magento 2 environment mode

The Magento 2 have 3 main environment modes.

  1. Default Mode - After fresh installation, if there is no other modes are not specified, our Magento 2 will be in default mode
  2. Developer mode - During development & customization, we have to use Developer mode
  3. Production mode - When we deploy our Magento installation to a production server, it must be production mode

The difference and details are avilable in the Magento Dev Doc.

Know the current mode

magento deploy:mode:show

Swich between Magento mode

I believe that your current directory is Magento installation root folder. If so, the command will be,

magento deploy:mode:set {mode}
Example - Switch to production mode
bin/magento deploy:mode:set production
Example - Switch to Developer mode

First delete the contents of the var/generation and var/di directories.

rm -rf var/di/* var/generation/*

Thedn switch mode

bin/magento deploy:mode:set developer

Note: We cannot currently change from either developer or production mode to default mode. Unless we specify developer / production mode, Magento installation will be in default mode.

Looking for a skilled WordPress/WooCommerce developer? I'm currently available for freelance, contract, or full-time remote opportunities! Let's create something amazing together. Send me a quick message, and I'll respond within 24 hours!

Recent Posts

  1. Automating Code Linting with GitHub Actions for WordPress Plugins
  2. Comprehensive Guide to Linting PHP, JavaScript, and CSS in WordPress Plugins Using Composer
  3. The Ultimate Guide to Indexing in Database Design
  4. Understanding 'update_meta_cache' in WordPress - When to Use It, When Not to, and Its Impact on Database Queries
  5. A Guide to Configuring JavaScript and SCSS Paths in WordPress Plugins with @wordpress/scripts

Your Questions / Comments

If you found this article interesting, found errors, or just want to discuss about it, please get in touch.