How to enable Magento 2 Developer Mode
Developer mode of Magento 2 is a special mode, which makes debugging and development much easier. Here is a short list of useful features of this mode:
- Verbose and extensible logging
- Automatic code compilation
- Enhanced debugging
- Shows custom
X-Magento-*
HTTP request and response headers
Switching via SSH/CLI
The best and safest way to switch Magento 2 to developer mode is using special CLI command. Here is what you need to to:
- Log in to your store via SSH/CLI and navigate to root of your store.
- Clean generated classes and other entities to prevent unchecked errors with command
rm -rf var/di/* var/generation/*
- Switch to developer mode using command
bin/magento deploy:mode:set developer
After running the latter command you will see log message below, which marks successful switching.
Switched to developer mode
Switching via .htaccess
Sometimes SSH/CLI access is not allowed (only FTP is allowed, for example). In such a cases you can forcibly switch Magento 2 to developer mode using special environment variable. Here is what you need to do:
- Log in and navigate to the root of your store
- Clean contents of directories
var/di
andvar/generation
- Open .htaccess file for editing.
- Put in suitable place (typically at the beginning) the line below:
SetEnv MAGE_MODE developer
It will forcibly make Magento 2 work in Developer Mode
Did you know…
… that tracking down source of error can be very tricky even in Developer Mode. Our company offers you our newest extension - Performance & Stability Suite.
It monitors code and configuration changes of your store automatically - so you will have all needed information prior (or even without need of) to switching to Developer Mode.
Additionally, this extension will automatically notify you, if something critical happened on your store. This will make process of error tracking and repairing of your store much quicker.