You can do it either via admin or via console command. here I am describing the step to do it via command line.
php bin/magento dev:template-hints:enable
this above is to enable.
if we required to disable, use below
php bin/magento dev:template-hints:disable
if we required to check the status, do the below
php bin/magento dev:template-hints:status
php bin/magento dev:template-hints:enable
this above is to enable.
if we required to disable, use below
php bin/magento dev:template-hints:disable
if we required to check the status, do the below
php bin/magento dev:template-hints:status