Can we delete 'setup' directory after successful magento 2 installation ?

What are the directories/files we can delete after magento 2 successful installation, especially E:\xampp\htdocs\magento2.1\setup\src\Magento\Setup\Test directory ?

2 Answers 2


In short, you should not remove the setup directory, without it bin/magento will not work.

As far as what you can safely remove... not a lot. The installer cleans up any unnecessary files once the Magento installation is complete. The only files i can think of are the ones ending in .sample (they are used when you want to create a new version of the file) which you can easily find on the internet if needed.

  • Thanks for your response. Can we delete 'Test' directory inside E:\xampp\htdocs\magento2.1\setup\src\Magento\Setup Aug 19, 2016 at 7:01
  • setup\src\Magento\Setup\Test is used for unit testing custom extensions. It contains code used by the magento CLI ( bin/Magento ). Here is a link on how it's used. I would not recommend removing it if you plan to expand your store. devdocs.magento.com/guides/v2.0/config-guide/cli/…
    – Radosav
    Aug 19, 2016 at 8:57
  • You meant, if we don't plan to expand the store, then we can delete and it'll not affect, right? Aug 19, 2016 at 9:33
  • Correct, so if you plan to never update/install an extension/theme than it shouldn't cause a problem. Either way, i would not worry about "extra" files, the installer does a pretty good job of removing all unnecessary files.
    – Radosav
    Aug 19, 2016 at 14:33

I dont have enough reputation to add a comment.

Regarding Radosav Answer, Please do not delete .sample files . Deleting those files will results in error when having cron jobs set.

This happened to me when I deleted the .htaccess.sample file from the root directory of magento 2 website. I got the following error:

update-cron.ERROR: Cron readiness check failure! Found non-writable paths:  .htaccess.sample.

Here is a list of files that should not be deleted

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.