Is there a way to list all Chocolatey packages that have no dependencies?
Sometimes I found unexpected packages in my Chocolatey package list, and want to know if they're safe to uninstall. I know I can try to uninstall them and wait for Chocolatey to remind me, but that means I have to do this one by one.
The following Powershell one-liner will display all dependencies for each package installed on your system
cd C:\ProgramData\chocolatey\lib
Get-ChildItem C:\ProgramData\chocolatey\lib -Recurse -Name "*.nuspec" | % { Select-String "<dependency" $_ }
I don't know of an answer to your exact question, as creating such a list would require a much better knowledge than mine of how Chocolatey installs products. I would then rather try to comment on the underlying problem you are facing, which is the reason that you asked this question.
It's possible to uninstall a Chocolatey package and all its dependencies using
the parameter
-x
(--forcedependencies
)
to also uninstall dependencies when uninstalling package(s).
The default behavior is not to uninstall dependencies.
For example :
choco uninstall notepadplusplus atom 7zip -x
With this switch, Chocolatey is supposed to only reduce the dependent count of any one dependency that is shared among several installed packages when one of the packages is uninstalled.
This means that you don't need to know if they have dependencies or not.
If by any bug Chocolatey ever mishandles this feature and uninstalls a dependency while it is still in use by another package, the damage is easily fixed. See the experiments carried out in this Stack Overflow answer.