Skip to content

Uninstall Mathesar

The uninstall instructions vary depending on the installation method you chose. Select your installation method below to proceed.

Uninstall a Docker installation of Mathesar

Note

Depending on your Docker setup, you may need to run docker commands with sudo.

  1. Remove the Mathesar container.

    docker rm -v mathesar_service
    
  2. Remove the Mathesar Image

    docker rmi mathesar_service
    
  3. Remove volumes related to Mathesar

    docker volume rm static &&
    docker volume rm media
    
  4. Remove Mathesar internal schemas.

    If you’d like to continue using your PostgreSQL database, you’ll need to remove the schemas created for Mathesar’s use during installation. You can remove them from the database as follows:

    1. Connect to the database.

      psql -h <DB HOSTNAME> -p <DB PORT> -U <DB_USER> <DB_NAME>
      
    2. Delete the types schema.

      DROP SCHEMA mathesar_types CASCADE;
      

      Deleting this schema will also delete any database objects that depend on it. This should not be an issue if you don’t have any data using Mathesar’s custom data types.

    3. Delete the function schemas.

      DROP SCHEMA msar CASCADE;
      DROP SCHEMA __msar CASCADE;
      

Uninstall a Guided script or Docker compose installation of Mathesar

  1. Remove all Mathesar Docker images and containers.

    docker compose -f docker-compose.yml down --rmi all -v
    
  2. Remove configuration files.

    rm -rf xMATHESAR_INSTALLATION_DIRx  # may need sudo, depending on location
    
  3. Remove Mathesar internal schemas.

    If you’d like to continue using your PostgreSQL database, you’ll need to remove the schemas created for Mathesar’s use during installation. You can remove them from the database as follows:

    1. Connect to the database.

      psql -h <DB HOSTNAME> -p <DB PORT> -U <DB_USER> <DB_NAME>
      
    2. Delete the types schema.

      DROP SCHEMA mathesar_types CASCADE;
      

      Deleting this schema will also delete any database objects that depend on it. This should not be an issue if you don’t have any data using Mathesar’s custom data types.

    3. Delete the function schemas.

      DROP SCHEMA msar CASCADE;
      DROP SCHEMA __msar CASCADE;
      

Uninstall a source installation of Mathesar

  1. Stop Caddy service

    systemctl disable caddy.service && systemctl stop caddy.service
    
  2. Remove Caddy service file and Caddyfile (requires sudo)

    sudo rm /lib/systemd/system/caddy.service
    sudo rm /etc/caddy/Caddyfile
    
  3. Stop Gunicorn

    systemctl disable gunicorn.service
    systemctl stop gunicorn.service
    
  4. Remove Gunicorn service file

    sudo rm /lib/systemd/system/gunicorn.service
    
  5. Remove your Mathesar installation directory

    rm -r xMATHESAR_INSTALLATION_DIRx  # May need sudo, depending on location
    

    Your installation directory might be customized

    It’s possible that Mathesar could have been installed into a different directory than shown above. Use caution when deleting this directory.

  6. Remove Django database

    1. Connect to the psql terminal.

      sudo -u postgres psql
      
    2. Drop the Django database.

      DROP DATABASE mathesar_django;
      
  7. Remove Mathesar internal schemas.

    If you’d like to continue using your PostgreSQL database, you’ll need to remove the schemas created for Mathesar’s use during installation. You can remove them from the database as follows:

    1. Connect to the database.

      psql -h <DB HOSTNAME> -p <DB PORT> -U <DB_USER> <DB_NAME>
      
    2. Delete the types schema.

      DROP SCHEMA mathesar_types CASCADE;
      

      Deleting this schema will also delete any database objects that depend on it. This should not be an issue if you don’t have any data using Mathesar’s custom data types.

    3. Delete the function schemas.

      DROP SCHEMA msar CASCADE;
      DROP SCHEMA __msar CASCADE;