How do you uninstall .pkg file?
Each .pkg file generally differ in where they install the files, so unlike a .app bundle, there is no generalized way to uninstall the contents of a .pkg file.

A .pkg file is an installer package. It is run with the help of the macOS built-in Installer app, and allows the installation of the files contained under the package under various directories as programmed by the developer of the software.

Here's are a bunch of approaches that can be tried:


Check the .pkg file and any associated files provided by the developer. Sometime, such software package also come with either a dedicated or a built-in uninstaller. Running the uninstaller generally takes care of uninstalling the files/apps installed by the package.

If you don't find any obvious uninstaller, consider contacting the developers of the app and ask them.
Use a 3rd party utility such as AppCleaner to uninstall the .pkg installed app. It gives you a simple interface to look through and select from all the installed apps, locates all the files associated with an app, and let you uninstall the app(s) completely.

From the app website:


  AppCleaner is a small application which allows you to thoroughly uninstall unwanted apps.
  
  Installing an application distributes many files throughout your System using space of your Hard Drive unnecessarily.
  
  AppCleaner finds all these small files and safely deletes them.
  
  Simply drop an application onto the AppCleaner window. It will find for the related files and you can delete them by clicking the delete button.

Prefer using Homebrew Cask to install the desired GUI app(s), if the developers is distributing them via Homebrew. To use Homebrew Cask, start by installing Homebrew and then run brew cask to install Homebrew Cask.

To see if an app is available via Homebrew Cask, simply run the following command to search the Homebrew database:

brew search &lt;app_name&gt; --casks


where &lt;app_name&gt; is full or partial name of the desired (GUI) app.

Homebrew Cask lets you easily install an app by running:

brew cask install &lt;app_name&gt;


To uninstall an app installed via Homebrew Cask, run:

brew cask uninstall &lt;app_name&gt;


To unconditionally remove all files associated with the given app which is installed via Homebrew Cask, run:

brew cask zap &lt;app_name&gt;


Make sure to update the Homebrew's local repository of all the available packages by running the following command, before attempting to search for and install packages:

brew update