جرّب خدماتنا مجانًا - سنقوم بإصلاح أصعب مشكلة في متجرك خلال 24 ساعة!

How to Enable Developer Mode in Magento 2 (Step-by-Step Guide)

When working with Magento 2, developers often need a way to quickly identify errors, debug issues, and test changes without caching interference. That’s where Developer Mode in Magento 2 comes in.

Enabling Developer Mode makes it easier to customize themes, install extensions, and troubleshoot problems. In this guide, we’ll walk you through everything you need to know about enabling developer mode in Magento 2, step by step.

Enable Developer Mode in Magento 2

? What is Developer Mode in Magento 2

Magento 2 operates under different application modes, each designed for a specific stage of your store’s lifecycle. These Magento 2 modes define how Magento handles errors, caching, and performance. Understanding the differences between them is crucial for developers, store owners, and system administrators.

Magento 2 has three main modes:

1. Default Mode

  • Description: This is the mode that Magento runs on right after installation. It is a sort of “middle ground” between development and production.
  • Key Characteristics:
    • Shows generic error messages instead of detailed ones (to avoid exposing sensitive information).
    • Some caching is enabled, but not as aggressive as in production.
    • Static files (CSS, JS, images) are generated on demand.
  • When to Use: Best suited for small-scale testing or staging environments, but not recommended for large-scale development or live production.

2. Developer Mode

  • Description: As the name suggests, this mode is built for developers actively working on the store. It prioritizes debugging and customization over performance.
  • Key Characteristics:
    • Displays detailed error messages directly in the browser, making it easier to identify and fix issues.
    • Caching is disabled, which ensures that every change in code is reflected immediately without having to clear caches constantly.
    • Static files are generated on the fly, so developers don’t need to recompile assets during frequent updates.
    • Supports tools like Xdebug for advanced debugging.
  • When to Use: Ideal during active development or when adding new features, modules, or themes. However, because caching is off, it is not suitable for live websites — it will slow down the store significantly if left enabled in production.

3. Production Mode

  • Description: This is the mode you should always use for your live Magento 2 store. It prioritizes performance, caching, and stability.
  • Key Characteristics:
    • Shows only generic error messages to customers (no sensitive details are exposed).
    • All static files are precompiled and served directly from the /pub/static directory.
    • Full-page caching, merging, and minification are enabled for faster page loads.
    • Performance is significantly better compared to default or developer mode.
  • When to Use: Always enable production mode once your store is ready to go live. This ensures maximum speed and security for customers.

In short:

  • Use Developer Mode during development for faster debugging and customization.
  • Switch to Production Mode when your site goes live to ensure optimal performance and security.
  • Avoid using Default Mode in most cases — it’s more of a transitional state and not ideal for serious development or live environments.

?Why Use Magento 2 Developer Mode

Enabling developer mode gives you several advantages:

  • Error Visibility – Detailed error messages instead of a generic “500 error.”
  • Faster Development – Static files are generated automatically, making it easier to test changes.
  • Debugging Support – Works well with Xdebug and other debugging tools.
  • Extension Testing – Helps ensure new Magento 2 extensions and themes work as expected.

How to Check Current Mode in Magento 2

Before enabling developer mode, you should check which mode your Magento installation is currently using.

Run the following command in your Magento root directory:

php bin/magento deploy:mode:show

You’ll see one of these results:

  • default
  • developer
  • production

How to Enable Developer Mode in Magento 2 (Step-by-Step)

Step 1: Access Your Server

You need SSH access to your Magento 2 installation. Connect to your server using a terminal or SSH client:

ssh [email protected]

Navigate to your Magento 2 root directory:

cd /var/www/html/magento2

Step 2: Enable Developer Mode

Run the following command to switch Magento 2 into developer mode:

php bin/magento deploy:mode:set developer

If successful, you’ll see:

Enabled developer mode.

Step 3: Clear Cache

To ensure changes take effect, clear the Magento 2 cache:

php bin/magento cache:clean

php bin/magento cache:flush

Step 4: Verify the Mode

Double-check that developer mode is active:

php bin/magento deploy:mode:show

You should now see:

Current application mode: developer

Troubleshooting Common Issues

Sometimes, you may run into issues while enabling developer mode:

  • Permission Errors
    • Ensure your Magento files have correct ownership and permissions.
  • Memory Limits
    • Increase PHP memory limit in php.ini if commands fail.
  • Blank Page After Switching Magento 2 Modes

Clear cache and regenerate static content:
php bin/magento setup:static-content:deploy -f

Switching Back to Production Mode

Once your development work is complete, switch back to production mode for better performance:

php bin/magento deploy:mode:set production

FAQs about Magento 2 Developer Mode

?Is developer mode safe for a live store

No, developer mode should only be used in a development environment. For live stores, always use production mode.

?Can I enable developer mode without SSH

You need SSH or direct terminal access to enable developer mode in Magento 2. Some hosting providers allow terminal access through cPanel.

Does enabling developer mode slow down Magento ?2

Yes, because caching is disabled. That’s why it’s not recommended for production environments.

Conclusion

Magento 2 developer mode is an essential tool for debugging, testing, and customizing your store. By following the simple steps in this guide, you can easily switch to developer mode, identify issues faster, and improve your development workflow.

At Growsera, we help businesses set up, optimize, and maintain their Magento 2 stores. Whether you need developer support or performance optimization, our team has the expertise to guide you. Contact us now