Search code examples
macports

Macports: what exactly does the -f flag mean?


Let's contrast

sudo port install [port_name]

and

sudo port -f install [port_name]

What exactly does the flag -f do in this case? Why don't we use the -f flag each time we install a new port?


Solution

  • The flag -f is to force the install/install. If there are dependencies that is preventing macports from installing/uninstalling, you can use the -f flag to force the install/uninstall but that is not a desirable way of installing/uninstalling.

    Take a look at explanation from https://guide.macports.org/

    sudo port uninstall libcomerr
    --->  Unable to uninstall libcomerr @1.42.9_0, the following ports depend on it:
    --->    kerberos5 @1.11.3_0
    --->    subversion @1.8.9_0
    --->    subversion-perlbindings-5.16 @1.8.9_0
    Error: port uninstall failed: Please uninstall the ports that depend on libcomerr first.
    

    You can recursively uninstall all ports that depend on the given port before uninstalling the port itself to work around this. To do that, use the --follow-dependents flag.

    $ sudo port uninstall --follow-dependents libcomerr
    

    You can also override this safety check using the -f (force) flag. Since this will obviously break the dependents you shouldn't do this unless you know what you are doing.

    $ sudo port -f uninstall libcomerr
    

    Although this is an example of uninstall, you can see how -f flag works.