Uninstall or reinstall Magento
Log in to the Magento server as, or switch to, a user who has permissions to write to the Magento file system. One way to do this is to switch to the Magento file system owner.
If you use the bash shell, you can also use the following syntax to switch to the Magento file system owner and enter the command at the same time:
su <Magento file system owner> -s /bin/bash -c <command>
If the Magento file system owner does not allow logins you can do the following:
sudo -u <Magento file system owner> <command>
To run Magento commands from any directory, add
<your Magento install dir>/binto your system
Because shells have differing syntax, consult a reference like unix.stackexchange.com.
bash shell example for CentOS:
You can also run the commands in the following ways:</p>
cd <your Magento install dir>/binand run them as
./magento <command name>
php <your Magento install dir>/bin/magento <command name>`
<your Magento install dir>is a subdirectory of your web server’s docroot. Need help locating the docroot?
In addition to the command arguments discussed here, see Common arguments.
Before you use this command, you must install the Magento software.
Update the Magento software
To update the Magento software:
- If you installed the software from an archive or if you used ‘composer-create-project’, use the Component Manager or System Upgrade utilities.
- If you are a contributing developer (that is, you used
git clone), see Contributing developers—update, reinstall Magento.
Reinstall the Magento software
This section discusses how to uninstall and then reinstall the Magento software with the latest version.
The way you reinstall the Magento application from the command line depends on your role:
- If you installed the software from an archive or if you used ‘composer-create-project’, see Reinstall as a system integrator.
- If you’re a contributing developer (that is, you started using
composer clone), see Contributing developers—update, reinstall Magento.
Reinstall as a system integrator
To reinstall the Magento software as a system integrator:
- Log in to your Magento server as a user with permissions to modify files in the Magento file system (for example, the switch to the Magento file system owner.
Enter the following commands in the order shown:
cd <your Magento install dir> git pull origin develop php bin/magento setup:uninstall
git pull origin developfails, see troubleshooting.
- To use your existing Magento software version , omit the
git pull origin developcommand.
Install the Magento software:
Uninstall the Magento software
Uninstalling the Magento software drops and restores the database, removes the deployment configuration, and clears directories under
To uninstall the Magento software, enter the following command:
The following message displays to confirm a successful uninstallation:
[SUCCESS]: Magento uninstallation complete.
Optionally keeping generated files
magento setup:upgrade clears compiled code and the cache. Typically, you use
magento setup:upgrade to update components and each component can require different compiled classes.
However, in some situations (particularly, deploying Magento to production), you might wish to avoid clearing compiled code because it can take some time. (The cache is still cleared.) To update the Magento database schema and data without clearing compiled code, enter:
magento setup:upgrade --keep-generated
--keep-generated option should be used only in limited circumstances by experienced system integrators. This option should never be used in a development environment. Improper use of this optional parameter can cause errors during code execution.
Install the Magento software: