Magento 2.0.18 is the final 2.0.x release. After March 2018, Magento 2.0.x will no longer receive security patches, quality fixes, or documentation updates.
To maintain your site's performance, security, and PCI compliance, upgrade to the latest version of Magento.

Set the Magento mode

In addition to the command arguments described in this topic, see Common arguments.

Run all Magento CLI commands as the Magento file system owner.

Overview of setting Magento modes

To improve security and ease-of-use, we added a command that switches Magento modes from developer to production and vice versa.

Production mode also has better performance because static view files are populated in the pub/static directory and because of code compilation.

  • In version 2.0.6 and later, Magento does not explicitly set file or directory permissions when you switch between default, develop, and production modes.
  • Unlike other Magento modes, developer and production modes are set in env.php.
  • Magento Commerce Cloud supports production mode only.

Refer to Magento ownership and permissions in development and production for more information.

When you change to developer or production mode, we clear the contents of following directories:



  • .htaccess files are not removed
  • pub/static contains a file that specifies the version of static content; this file is not removed

By default, Magento uses the var directories to store the cache, logs, and compiled code. You can customize this directory but in this guide, it’s assumed to be var.

Display the current mode

The easiest way to do that is to run this command as the Magento file system owner. If you have shared hosting, this is the user your provider gives you to log in to the server. If you have a private server, it’s typically a local user account on the Magento server.

Command usage:

bin/magento deploy:mode:show

A message similar to the following displays:

Current application mode: developer.

Change modes

Command usage:

bin/magento deploy:mode:set {mode} [-s|--skip-compilation]


  • {mode} is required; it can be either developer or production

  • --skip-compilation is an optional parameter you can use to skip code compilation when you change to production mode.

You cannot currently change from either developer or production mode to [default mode](/guides/v2.0/config-guide/bootstrap/magento-modes.html#default-mode).

Examples follow.

Change to production mode

bin/magento deploy:mode:set production

Following is a summary of messages that display:

Enabled maintenance mode
Requested languages: en_US
=== frontend -> Magento/luma -> en_US ===
... more ...
Successful: 1884 files; errors: 0

=== frontend -> Magento/blank -> en_US ===
... more ...
Successful: 1828 files; errors: 0

=== adminhtml -> Magento/backend -> en_US ===
... more ...

=== Minify templates ===
... more ...
Successful: 897 files modified

New version of deployed files: 1440461332
Static content deployment complete Gathering css/styles-m.less sources. Successfully processed LESS and/or   <span term-uuid="45f1f76d-91cd-4789-a8b5-1e3f321a6280" class="glossary-term" data-toggle="popover">Sass</span>  files   <span term-uuid="6c5cb4e9-9197-46f2-ba79-6147d9bfe66d" class="glossary-term" data-toggle="popover">CSS</span>  deployment complete Generated classes:
    ... more ...
Compilation complete
Disabled maintenance mode
Enabled production mode.

Change to developer mode

When you change from production to developer mode, you should clear generated classes and Object Manager entities like proxies to prevent unexpected errors. After doing so, you can change modes. Use the following steps:

  1. If you’re changing from production mode to developer mode, delete the contents of the var/generation and var/di directories:

    rm -rf <your Magento install dir>/var/di/* <your Magento install dir>/var/generation/*
  2. Set the mode:

    bin/magento deploy:mode:set developer

    The following message displays:

    Switched to developer mode.

Run Magento CLI commands from anywhere

Run Magento CLI commands from anywhere.

If you haven’t added <magento-install-directory>/bin to your system PATH, then you can expect an error when running the Magento command by itself.