Magento 2 is a popular e-commerce platform. Developer Mode is a special mode that helps developers debug and test their websites. It shows detailed error messages and logs, making it easier to find and fix issues. Sometimes you may need to enable or disable Developer Mode in Magento 2. Here are two easy methods to do it.

Method 1: Changing Mode via SSH/CLI

This is the quick and suggest way to enable or disable developer mode on Magento2 application.

Enable Developer Mode:

  1. Login to the system, where Magento 2 application is configured.
  2. Navigate to Your Magento 2 Directory:
    
    cd /path/to/your/magento2
    
    
  3. To enable the developer mode, type:
    
    php bin/magento deploy:mode:set developer
    
    
  4. You should see a message saying Developer Mode is enabled.

Disable Developer Mode:

To disable the developer mode, simple type:


php bin/magento deploy:mode:set production

You should see a message saying Developer Mode is disabled.

Method 2: Changing Developer Mode via .htaccess

Instead of making changes in configuration, You can also enable Magento2 developer mode using .htaccess file. But tis will work only if application is configures with Apache web server.

Enable Developer Mode:

  1. Find and edit the .htaccess file in your Magento 2 root directory.
  2. Add this line at the top of the file:
    
    SetEnv MAGE_MODE developer
    
    
  3. Save the file.

Disable Developer Mode:

  1. Remove the line SetEnv MAGE_MODE developer or change developer to production.
    
    SetEnv MAGE_MODE production
    
    
  2. Save the file.

Wrap Up

Enabling or disabling Developer Mode in Magento 2 is simple. You can use SSH/CLI or edit the .htaccess file. Remember, you should not enable Developer Mode on a live, production website because it shows detailed error messages and logs that can slow down your site and expose sensitive information. Use Developer Mode only for testing and debugging during development.