/ / How to delete macports

How to delete macports?


This section lists common operations you may want to perform when managing a MacPorts installation. These are the workflows you will need most while using MacPorts. We recommend you read at least this section as a primer into how to use MacPorts. More details about the usage can be found in Section 3.1, “The port Command” and the port(1) manpage available by running man 1 port in a Terminal.

Mind the “ sudo ” for some of the subsequent examples, which is necessary if you have a default MacPorts installation.

3.3.1.В Updating Your Ports Tree

The local ports tree is a collection of files that contain information on which packages are available through MacPorts and how they can be installed. You should regularly update your ports tree to get access to updated versions of software and bug fixes. To do that, use selfupdate :

3.3.2.В Show Ports Which Need Updating

To see what's new after running selfupdate , you can use port outdated to generate a list of ports that have newer versions available. This can help in estimating the time required for sudo port upgrade outdated , even though this depends on further factors such as binary package availability and a port's build time.

3.3.3.В Upgrading Outdated Ports

To upgrade all your installed and outdated ports, run

In case you want to upgrade only a specific port (not recommended unless you know what you are doing), replace “ outdated ” in the command given above with the port's name:

Note that MacPorts will upgrade any dependencies of a port first before updating the port itself. So even if you request the update of a single port only, other ports may be upgraded first because they are in the dependency tree. Do not try to avoid this, as it will very likely lead to problems later on – the new version of the port you want to upgrade might require the newer dependency, or it might only have been upgraded at all to be rebuilt against the updated dependency, in which case avoiding the update of the dependency defeats the purpose of the reinstallation.

3.3.4.В Removing Inactive Version(s) of Upgraded Port(s)

By default, upgrading ports in MacPorts does not remove the older versions. This is a safety measure to ensure you can go back to a working and tested version in case an update goes wrong. To save disk space, you should periodically uninstall any old versions you no longer need.

to get a list of inactive ports you likely no longer need.

Check the list for any ports you might still want to keep. To remove all of them at once, run

Of course you could also select only a specific inactive port, but that requires to specify the exact version:

To uninstall all inactive ports but a single one, you can use the following shortcut:

3.3.5.В Finding Ports Depending on a Certain Port

If you want to find all ports that depend on a given other port, you can use

If you are only interested in the dependent ports that you actually have installed, you can use the quicker and more accurate dependents :

MacPorts also has a recursive version of the dependents action called rdependents :

Finally, to find out which port you manually installed caused the automatic installation of a dependency, use the following expression:

3.3.6.В Finding Leaves

After a while of using MacPorts, installing and uninstalling ports, packages that have been automatically installed as dependencies for other ports are left behind, even though they are no longer necessary. Ports that have not been manually installed ( “ requested ” ) and do not have any dependents are called “ leaves ” and can be identified using the leaves pseudo-port, for example in conjunction with the echo or installed action.

These leaves may be wanted, but are in most cases unneeded. See Section 3.3.7, “Keep Your Installation Lean by Defining Leaves as Requested Ports” to find out how to mark some of the leaves as requested. You can uninstall all leaves using

Note that the uninstallation can cause new ports to become leaves. To uninstall all leaves, you can use the rleaves pseudo-port instead.

To go through this process interactively so you can make sure you're not uninstalling anything you want to keep, you can install the port_cutleaves port. After installation, run it with

3.3.7.В Keep Your Installation Lean by Defining Leaves as Requested Ports

Well, before we come to the procedure of defining your requested ports, let's have a look at a typical scenario where you want to understand what is actually installed and what is on the other hand truly necessary for your system. Say checking leaves of your MacPorts installation gives this output:

Now it is up to the user to decide what's needed and what is not. We've noticed pkgconfig is needed to build many ports, and while it is strictly not needed after installation, we'd like to keep it around to avoid installing it over and over again. python32 , texi2html , and yasm are only needed to update mplayer2 , and since that software is rarely updated, we will re-install those ports again when they are needed. Since they are all distributable, MacPorts will use pre-built binaries for their installation anyway, so re-installing them wouldn't take long anyway. We don't really know why the rest of the leaves were installed, so we're just going to remove them for now.

Since we decided to keep pkgconfig , we are going to mark it as manually installed ( “ requested ” in MacPorts lingo) using:

When you've step-by-step figured out which ports you want to keep on your system and have set them as requested, you'll have a list of unnecessary ports, which you can get rid of using

Note that uninstalling leaves may mark new ports as leaves, so you will have to repeat the process. You can install the port_cutleaves port, which is a special script for the job. It allows you to interactively decide whether to keep or uninstall a port. Run it as

You can get a list of all ports you previously set as requested (or installed manually) using:

We recommend you check the list of leaves from time to time to keep your system free of too much “ garbage ” . You should also periodically check the list of your requested ports and mark any ports you no longer need as unrequested using

Then check for new leaves to cut down the number of installed ports and the size of your MacPorts installation.