What does the --force option do in homebrew?

1

I often see programmers recomend using the --force option when removing a homebrew package:

brew remove <package> --force.

Why is the --force option available? What does it effect in the removal process?

kilojoules

Posted 2016-02-05T05:06:54.620

Reputation: 590

Answers

1

It ignores all errors during execution of the removal and all scripts around it (pre and post removal), and just continues to remove all files in the package. This is mostly useful if the package wasn't installed properly or if there's a problem with the machine it was installed on, for example if specific directories were removed already so the removal script couldn't do so.

Teun Vink

Posted 2016-02-05T05:06:54.620

Reputation: 2 107

But why is this an option? Is there a case where this is not desirable? – kilojoules – 2016-02-05T05:45:19.240

Under normal conditions a problem with one of the steps in the removal script should cause it to stop, so the admnistrator has control over what to do next, for example by fixing the problem causing the script to stop. – Teun Vink – 2016-02-05T08:17:38.323

In addition to the above: it may be damaging to force some of these commands. For example, if files not provided by the packages were placed in a directory created by a package, the script would fail on deleting the directory after all files provided by the package were removed, because the directory is empty. Forcing the deletion of the directory by default could result into unwanted deletion of files. – Teun Vink – 2016-02-05T09:07:07.760