How to Set Production Mode in Magento 2

In this tutorial, we will talk about How to Set Production Mode in Magento 2 via Command Line Series. As you know, from Magento 2, they add many commands in bin/magento. This may be difficult to approach, let me explain in more detail about it.

An overview of Magento 2 modes

Magento 2 Default mode

This mode is when you see how Magento works without any custom settings. It lacks a lot of necessary features used for production, so you will need to switch to another mode.

Magento 2 Developer mode

This mode is usually used when you need to customize your Magento 2 store or install extensions to expand Magento 2 Default’s functionalities. With Developer mode, you can do all development tasks.

In this mode, static view files will be written in the Magento pub/static directory every time they are called and are not cached.

Magento 2 Production mode

In Magento 2, you will need to add a command that switches Magento modes from developers to production mode. This action improves the security of your Magento 2 system and makes it easier for you to use.

Moreover, production mode brings in better performance because static view files are populated in the pub/static directory and because of code compilation.

Now let’s dig into the tutorial of changing to Production mode in Magento 2.

How to set Product Mode

Show current Magento 2 Mode

php bin/magento deploy:mode:show


$ php bin/magento deploy:mode:show
Current application mode: default. (Note: Environment variables may override this value.)

Currently, we are in default mode. We can set to Production mode

Set Production Mode

You are a merchant or just want to change to production mode, just run the following command line in Magento root folder:

php bin/magento deploy:mode:set production


$ php bin/magento deploy:mode:set production
Enabled production mode.

Congrats! Now your store is running in production mode.

Enjoyed the tutorial? Spread it to your friends!


Sam Thomas

Sam Thomas>Haley

CEO and Founder of Mageplaza. Pursueing a simple and healthy lifestyle. A friend, a husband and a dad of two children, a trainer and an influencer wannabe. He is a big fan of sports and travel, also.