Use the pkgrm(1M) command to remove both fully and partially installed packages or sets from the system. pkgrm attempts to return the system to the same state in which it was running before the package or set was installed.
To remove a single software package or set from your system,
pkgname is the name of the package you want to remove.
If pkgname is the name of a SIP, all packages that are members of the set,
and the SIP itself, are removed in reverse order from the order
in which they were installed.
To remove multiple software packages or SIPs from your system,
you might enter:
pkgrm pkgA pkgB pkgC.2
Separate each package name with whitespace.
To remove a package in non-interactive mode, add the -n option. If the package cannot be removed in this mode (because some interaction is required), pkgrm(1M) exits and the removal fails.