Starting anew

Some users have been asking how to reinstall Fink. This might be necessary when there isn’t an upgrade path — for instance, there’s no upgrade path from 32-bit Fink to 64-bit Fink, or when trying to replicate a Fink installation from one architecture (e.g. PowerPC, 32-bit Intel) to another (e.g. 64-bit Intel). This text explains how to save the list of installed packages and their configuration files in order to conveniently reinstall them on a clean Fink installation. Bear in mind that packages in one platform may not be available on another. For example, some packages are only available for PowerPC, and 64-bit Fink has (at the moment) fewer packages than on 32-bit Intel, 32-bit Fink.

Note: if you’re not sure how to execute the commands listed below on a terminal window, contact someone that’s more familiar with Unix and shells.

Preamble: Understanding virtual packages

Virtual packages are placeholders for packages or features that are present on your system but haven’t necessarily been installed by Fink itself. Some of them are system virtual packages, representing files that are shipped with the system (e.g. system-java, system-perl), whilst others may represent files installed by either Fink (e.g. pdftex) or the user (e.g. growl). Some of these virtual packages do not actually refer to files on your system. For example, the 64bit-cpu virtual package is just an indication that the system has a 64-bit processor. At any rate, virtual packages are managed by Fink and you can’t run commands fink install or fink remove on them.

Listing installed packages

Fink provides a handy command to list installed packages:

fink list --installed


fink list -i

for short. This command outputs a human-readable list of packages that are considered to be installed on your system, including packages you’ve installed yourself, their dependencies, and virtual packages. The following command trims virtual packages off this list:

fink list -i | grep -v " p " | grep -v "\["

We may use the -t flag and the cut command to get a nice list of installed packages that doesn’t include virtual packages:

fink list -it | grep -v " p " | grep -v "\[" \
| cut -f2

In order to save this list to a file (e.g. instpkgs.txt) for further reference, use the command

fink list -it | grep -v " p " | grep -v "\[" \
| cut -f2 > instpkgs.txt

Saving configuration files

If you’re planning on removing your entire /sw folder then you should consider saving your configuration files. Fink’s configuration file is /sw/etc/fink.conf. Packages may also place configuration files under /sw, usually under but not limited to /sw/etc (on my system there are package configuration files under /sw/etc, sw/lib, and /sw/var).

The following command lists the configuration files of every package in instpkgs.txt as created in the previous section, saving the list in conffiles.txt:

cat instpkgs.txt | xargs fink dumpinfo -fconffiles \
| sed "s/^conffiles: //;s/^[ \t]*//" | tr " " "\n" \
| sort | uniq > conffiles.txt

Browse through this list and backup the configuration files you want to keep (don’t forget to write their original location down). Some of them don’t need to be backed up (e.g. /sw/etc/passwd-fink). If you want to know which package installed a certain configuration file (e.g. /sw/etc/pkgconffile.conf), run the following command:

dpkg -S /sw/etc/pkgconffile.conf

Please note that if you’re changing from a 32-bit Fink installation to a 64-bit Fink installation then it is possible that old configuration files won’t work on the new installation. As this is particular to each package there’s no general solution for it. If you’re changing from one OS X version to another, or from 32-bit Fink to 64-bit Fink, it is also possible that your old fink.conf won’t work on the new installation, especially the Distribution and SelfUpdateTrees entries. You’re better off using your old fink.conf as a guide when answering the questions asked by Fink during installation/bootstrapping or when running the

fink configure


Local packages

If you’ve created local packages under /sw/fink/dists/local, don’t forget to backup them up. You probably won’t need to keep the binaries so it should be safe to keep only the package descriptions and patches; those are usually under /sw/fink/dists/local/main/finkinfo.

Removing Fink

Every file installed by Fink is under the /sw folder, so running the following command will wipe out your Fink installation:

sudo rm -rf /sw

Well, not exactly. Fink also places convenient shortcuts under /Applications/Fink for packages that are application bundles (those special folders whose name end with .app). If you use the fink remove command to remove a package that provides an application bundle then the equivalent shortcut is removed. However, if you simply remove the /sw folder, the shortcuts won’t get removed, so you might want to do that yourself.

Depending on how you’ve installed Fink or if you’ve run the pathsetup shell script, you might have a line resembling

test -r /sw/bin/ && . /sw/bin/

in your $HOME/.profile shell initialisation script (or the equivalent command/file for csh, tcsh). The line above can be left there if you’re planning on reinstalling Fink. It is also harmless to leave if there if Fink is not installed.

Installing Fink

Follow the installation instructions on Fink’s Web site. Recall that at the moment there is no binary installer for OS X 10.6, Snow Leopard, so you need to use the source installation from version 0.29.9 or higher.

Reinstalling the packages

You may use the instpkgs.txt created in the Listing installed packages section. The following shell script reads that file, line by line, and runs Fink’s installation command on each package:

cat instpkgs.txt | while read pkg
  fink install $pkg

Note that if you’re using sudo then this shell script will ask your password every now and then. You might want to save the whole script to a file (e.g. and run it with sudo (e.g. sudo ./

As some of the packages in instpkgs.txt are dependencies of other packages it is quite probable that you’ll get some No packages to install warnings which may safely be ignored — they mean that the command above is trying to install a package that’s already been installed. If a package is not available on your new installation, you’ll get Failed: no package found for specification errors.

You may also want to restore the configuration files you’ve saved. Remember that if you’ve changed from one platform to another there might be differences in the configuration files. Whenever possible, use the application itself to enter the configuration, using the old (backed up) configuration file as a guide.

If you’ve backed up your local packages, restore them to /sw/fink/dists/local and run

fink index

so that Fink becomes (once again) aware of them.


10 responses to “Starting anew

  1. Upgraded my machine to 10.6,
    installed the dev tools,
    downloaded 0.29.9,
    did ./bootstrap
    chose 64-bit only.

    pod2man –section=1 /sw/src/ > dpkg-architecture.1
    /bin/sh: /usr/bin/pod2man: Permission denied
    make[2]: *** [dpkg-architecture.1] Error 126
    make[1]: *** [all-scripts] Error 2
    make: *** [all-recursive] Error 2
    ### execution of make failed, exit code 2
    phase compiling: dpkg-bootstrap-1.10.21-1218 failed

    how can i fix this?

  2. Hello, Tom. Could you please send an e-mail containing your bug report to fink-users at I personally don’t recall anyone else reporting this problem. If you can provide the exact sequence of commands you’ve run, that’d be better.

  3. Follow-up: the conclusion on the mailing list was that /usr/bin/pod2man on users’s system didn’t have the executable bit set.

  4. Ich moechte ihnen ein geschaeftliches Angebot bezueglich ihrer Webseite machen, schreiben Sie mir bitte eine Email, falls Sie interessiert sind.

    Hi there, I veryrecently located your site and would like to speak to you about a possible business venture that would be of great benefit to you. Please email me
    at the given email address.

  5. When I run:

    cat instpkgs.txt | while read pkg
    fink install $pkg

    Fink installs the next uninstalled packages, and quits the loop

    When I run

    cat instpkgs.txt | while read pkg
    echo $pkg
    #fink install $pkg

    the output is a list of all packages in the instpkgs.txt file

    Why does fink break the while loop?

  6. Solved! As explained by choroba:
    fink reads from stdin and flushes the input file. The solution is to let fink read from nowhere (/dev/null)

    cat instpkgs.txt | while read pkg
    echo $pkg
    fink install $pkg < /dev/null

  7. A couple of alternative scripts that I’ve used:

    For capturing the package list:

    grep -B1 “install ok installed” /sw/var/lib/dpkg/status | grep “^Package:” | cut -d: -f2 | cut -d\ f2 > finkinst.txt

    (the last “cut” trims the leading space). This script is convenient because it works even if fink and dpkg don’t, e.g. following an OS X update–people who updated from 10.6/i386 to 10.7 reported problems with dpkg ceasing to work.

    For reading the package list:

    cat finkinst.txt | xargs fink install

  8. The /dev/null trick worked, thank you!

  9. After looking at a few of the blog posts on your web page, I seriously like your way of writing a blog.

    I saved it to my bookmark site list and will
    be checking back soon. Please visit my website
    too and let me know how you feel.

  10. This is a very good tip especially to those fresh to the blogosphere.

    Short but very accurate info… Thank you for sharing this one.
    A must read article!

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