Cleaning Fink up: files

So you’ve installed Fink, played around with its selection of packages, installing and removing several of them, and now you feel like cleaning it up. There are a few things to consider. Be sure to read the highlighted text, and be careful when running the commands listed below.


When Fink installs a package it needs one or more .deb files, which contain the individual files that are to be installed on the system. These .deb files can be obtained via a binary distribution or built from source. In the latter, Fink downloads source files (usually .zip, .tar.gz, .tar.bz2 files), compiles the package from source, and creates one or more .deb files. After a package has been built its source files can be removed; after a package has been installed its .deb files can be removed. They won’t be needed again unless you need to (re)build or (re)install that particular version of the package.

The fink cleanup command

Fink provides a cleanup command that can be used to remove source and .deb files that are obsolete, i.e., they are neither present in your current distribution (e.g. the package has been removed from Fink or it has been updated to a newer version) nor installed. Run the following command on a terminal window.

fink cleanup

Note that this command will keep source and .deb files of packages that are currently installed, as well as source and .deb files of packages that are not installed but are up-to-date. In summary, fink cleanup only removes files that won’t be necessary if you decide to (re)install a package.

Removing source files

In a standard Fink installation source files are downloaded into the folder /sw/src. If you want to get a listing of the files under that folder, sorted by size, run the following command on a terminal window.

ls -hklsS /sw/src

In order to zero that folder out, run the following command on a terminal window.

sudo rm -rf /sw/src/*

The only disadvantage of removing source files is that if Fink needs them then it’ll download them again.

Removing .deb files

There are two main folders where .deb packages are kept. Packages that are built from source files are placed under /sw/fink/dists; the specific folder depends on the tree and the section the package belongs to, and your system’s processor. For example, a .deb file of a package that is in the unstable/main tree, belongs to the graphics section, and was built on an Intel system is placed under /sw/fink/dists/ustable/main/binary-darwin-i386/graphics. If you want to list every .deb file built by Fink, run the following command on a terminal window.

find -L /sw/fink/dists -name \*.deb

In order to remove all of them, run the following commands on a terminal window.

sudo find -L /sw/fink/dists -name \*.deb -exec rm {} \;
fink scanpackages

If Fink needs to (re)install a package and it can’t find a suitable .deb file then it’ll build it from source. Building a package may take considerable time.

If you are using binary distributions, Fink will, whenever possible, download prebuilt .deb packages instead of building them from source. They are placed under the folder /sw/var/cache/apt/archives, and you may remove them by running the following command on a terminal window.

sudo rm /sw/var/cache/apt/archives/*.deb
fink scanpackages

If Fink needs to (re)install a package and it can’t find a .deb file then it’ll try to download it from a binary distribution, and some .deb files are quite big. If that .deb file is not available on a binary distribution, then Fink will build it from source, and building packages may take considerable time.

Another reason to keep your .deb files around is that that during a build, fink may need to swap packages containing headers, the so-called BuildDependsOnly packages, in order to build against different versions of libraries. If it discovers that there isn’t a .deb corresponding to a currently installed package, of identical version and revision, that is going to be swapped out, then it will stop and complain about the lack of a .deb file.


3 responses to “Cleaning Fink up: files

  1. Pingback: Cleaning Fink up: packages « Finkers

  2. Thanks for the useful tips. I have a laptop with a small amount of hard disk space, so I really need to get rid of the extra stuff.

    It would be nice if fink offered this as a built in command.

  3. Sorry to bump an old thread. I have the same problem with lack of space. I would like to delete my .deb files as well. I’m reluctant because of the very last sentence. What do I do if fink stops and complains about a missing .deb file?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s