How to Enable Developer Mode in Magento 2
The Developer mode in Magento is used when you want to customize your Magento 2 or add a new extension to the store. Magento 2 offers three different modes of use to its user admin:
- Default Mode
- Developer Mode
- Production Mode
You can use different modes for Magento stores depending on specific needs and circumstances. In this post, you will get to learn how to Enable Developer Mode in Magento 2.
Following are the useful features available in Developer mode:
- Verbose and extensible logging
- Compilation of code automatically
- Improved debugging
- Display custom
X-Magento-*HTTP request and response headers
Switching via SSH or CLI
One of the best ways to switch Magento 2 to developer mode is by using a special CLI command. Here are the steps that you need to take:
- Log in to the Magento store via SSH/CLI and go to the root of your store.
- Clean generated classes and entities in order to prevent unchecked errors by using the command below:
rm -rf var/di/* var/generation/*
- Go to developer mode using the following command:
bin/magento deploy:mode:set developer
- After successfully running the above command, you will see a message in the log below, indicating the successful switch
Switched to developer mode
Switching via .htaccess
Some hosts do not allow SSH/CLI access except FTP.
For example, If this happens to you, you can force Magento 2 to go into developer mode using a special environment variable. Here are the steps you need to follow:
- Log in to the Magento store and go to the root of your store.
- Clean data of directories
- Open the .htaccess file and edit it.
- Add the following line (usually at the beginning):
SetEnv MAGE_MODE developer
This will force Magento 2 to run in Developer Mode.
Do you know?
Knowing the root causes of an error in developer mode is challenging and hard to find? But, we at Magespark can help you identify the root causes of an issue in Developer Mode in no time as this is something we are master of.
If you have any questions or need any further assistance, please feel free to contact us.