Can't remove Laravel installation with composer on a Mac.

Updated: Feb 22, 2025

Can't remove Laravel installation with composer on a Mac.

When trying to remove a Laravel installation using Composer on a Mac, you might encounter some issues due to various reasons such as dependencies, symlinks, or configuration files. Here's a step-by-step guide to help you uninstall Laravel and its dependencies using Composer effectively.

  1. Navigate to your project directory: Open Terminal and type the following command to navigate to your Laravel project directory:

    cd /path/to/your/laravel/project
    

    Replace /path/to/your/laravel/project with the actual path to your Laravel project.

  2. Remove the Laravel project: To remove the Laravel project and its dependencies, run the following command:

    composer global remove laravel/installer
    

    This command will remove Laravel installer, which is used to create new Laravel projects. If you don't want to remove it, you can skip this step.

  3. Remove the vendor directory: To remove the vendor directory and its contents, run the following command:

    rm -rf vendor
    

    Be careful when using the rm command, as it can delete files and directories permanently. Make sure you're in the correct project directory before running this command.

  4. Remove the autoload file: To remove the autoload file, run the following command:

    rm composer.lock
    
  5. Remove the Laravel configuration file: Laravel stores its configuration file in the root directory of the project. To remove it, run the following command:

    rm .env
    
  6. Remove the symlink (optional): If you created a symlink to access the Laravel project, you can remove it by running the following command:

    rm -rf ~/laravel_project_name
    

    Replace laravel_project_name with the name of your Laravel project symlink.

  7. Verify the removal: To verify that Laravel and its dependencies have been removed, run the following command:

    composer list
    

    This command will display a list of all installed Composer packages. If Laravel is no longer listed, then the uninstallation was successful.

If you still encounter issues or need to remove other Laravel-related files, you can refer to the following resources: