I love using Cygwin, but I hate all of the extra disk space it seems to use caching stuff I don't need. What can I delete to keep my installation footprint as small as possible?

On a related note, what is a good barebones set of packages that will give me the essentials, without fluff that I'll probably never run?


9 Answers 9


Some people appear to be under the assumption that it is easy to swap out the hardware on whatever platform this person is using. It may very well be that 500MB is actually a large amount of space to sacrifice if they are perhaps using a CF adapter and a 4GB card to run windows on a netbook or similar. Or they may be installing it to a virtual image and this extra information means the difference between it fitting on a DVD unzipped or having to span multiple DVDS and dealing with the issues that come with that, especially if it is being sent to a client that isn't particularly technical for example; In-house training material for the application your company develops. Having one defined image that is the same for all trainees works wonders, makes the environments homogenous and makes the trainer's life easier. Virtual images are a simple way to do this in most situations.

Solve the problem that the user asked about or ask them a question to get more information.


When installing Cygwin, on the screen where it asks you where to store your packages, point it at a specific location, say c:\Cygwin\Packages. Install as normal, run it to check that it operates correctly. Delete the folder the packages are stored in, if required for updates Cygwin will download it again, not the most effective use of bandwidth but depending on your requirements it may be better than keeping the cache locally.

Another option is to install these packages, but the first time you do it, save the packages to another location like a USB drive, then if you have to do

  • 1
    I wonder if there's a way to regularly delete the tmp folder? May 14, 2014 at 8:20
  • 1
    @CMCDragonkai, A simple self-script would do?
    – Pacerier
    Oct 15, 2015 at 21:21

I note that that my current install is under 250MB, It would have to be four times that size before I started to care about it on my laptop.

But, if you have needs to get it smaller...

Download the installer. Save it to to c:\cygwin\setup.exe. Run the installer. Unselecting as many of the packages as you can. Noting, that if you select a package that has requirements, it will auto-select the needed packages. Remove the installer cache (which should have defaulted to c:\cygwin(http|ftp)somethingoranother. Rerun the installer from c:\setup.exe attempting to uninstall more packages. Repeat until the installer is as small as you wish.

Note, there will be a bunch of basic library packages that will be required in even the most minimal install. I have in the past (about a year ago), gotten it down to under 100 megs while still having everything I ever threw at it in terms of bash scripting.

  • 1
    "Laptop"? Are you running a actual proper multi-user server on a laptop?
    – Pacerier
    Oct 15, 2015 at 21:22

I can't use Windows without installing Cygwin, but I've never really had too much of a problem with it using disk space though. I think you can delete the folder Cygwin stores the packages in but every time you update Cygwin it will download the packages it needs.

As for a barebones setup, it really depends on what you need. I start with the base Cygwin install and add OpenSSH, Cron, RXVT, Screen, Vim, Git, Curl, Zip/Unzip, and Wget. Those are most all the tools I need, but I just install something else if the need arises.


Instead of Cygwin, you could also go with more packages that are not intending to solve all the problems Cygwin aims to be able to solve. There are packages of unix utilities with just the a limited selection of the most commonly used programs.

Unix Utilties for Windows is the one I used back in the day, but it appears to be a dead project.

GnuWin32 appears to still be alive.


I would start with the basic cygwin package, and 'page-fault' in any additional commands you need. I keep a list of common utilities which I use, but might be quite different from what you use. Do NOT select ALL packages when you install Cygwin. I did this once and it took about 6GB. My thinking was then I'd never have to worry about not having a program. It was a bad idea.

My Windows XP machine has 1.1 GB in service pack uninstall data. I'd delete those files well before trying to trim down Cygwin. Try using the WinDirStat program and see where all your hard drive space is going - it's probably not Cygwin. Also, from time to time, you should probably delete C:\cygwin\tmp, as this doesn't get cleared on reboot.

  • I've already deleted the leftover SP MSIs, and I use WinDirStat often to trim cruft. Thanks for the suggestions :) Jul 13, 2009 at 17:08

You could switch from CygWin to Gow, a lightweight alternative to CygWin (about 10 times lighter)


If you've pulled the setup files more than once you'll see that unused files are left behind...

To cleanup a Cygwin install set (not the installed code base but the package used to DO the install...

I think I saw a perl script to do this somewhere, but try this java code to cleanup a Cygwin setup:

    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.InputStreamReader;
    import java.text.DecimalFormat;
    import java.util.HashSet;

    public class CygwinCleaner {
            boolean doClean = false;
            long diskFileCount = -1;
            long setupFileCount = 0;
            long missingFileCount = 0;
            long srcFileCount = 0;
            long deleteCount = 0;
            public HashSet<String> pkgs = new HashSet<String>(9999);

            public String formatCount(long count) {
                    DecimalFormat df = new DecimalFormat("##,###");
                    String retval = "      " + df.format(count);
                    return retval.substring(retval.length() - 6);

            public void checkForMissingFiles() {
                    for (String filename : this.pkgs) {
                            if (!filename.contains("-src.")) {
                                    if (!((new File(filename)).exists())) {
                                            System.err.println(" Missing " + filename);

            public void checkOrCleanFiles(File testfile) {
                    String tfap = null;
                    if (testfile.isDirectory()) {
                            for (File file : testfile.listFiles()) {
                    } else {
                            tfap = testfile.getAbsolutePath();
                            if (!this.pkgs.contains(tfap)) {
                                    if (this.doClean) {
                                            System.err.println("Deleting \"" + tfap + "\"");
                                            if (testfile.delete()) {
                                            } else {
                                                    System.err.println("COULD NOT DELETE \"" + tfap + "\"");
                                    } else {
                                            System.err.println("WOULD delete \"" + tfap + "\"");

            public boolean loadFileList(File file) {
                    boolean retval = false;
                    if (file.exists()) {
                            try {
                                    String basedir = (new File(file.getParent())).getParent() + "/";
                                    basedir = basedir.replace('\\', '/');
                                    BufferedReader br = null;
                                    br = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
                                    String line = br.readLine();
                                    String installFile = null;
                                    boolean processlines = false;
                                    while ((line = br.readLine()) != null) {
                                            if (processlines) {
                                                    if (line.startsWith("install:") || line.startsWith("source:")) {
                                                            installFile = line.substring(1 + line.indexOf(" "));
                                                            installFile = installFile.substring(0, installFile.indexOf(" "));
                                                            installFile = basedir + installFile;
                                                            String hashString = (new File(installFile)).getAbsolutePath();
                                                            if (!this.pkgs.contains(hashString)) {
                                                                    if (line.startsWith("source:")) {
                                            if (line.startsWith("@ ")) {
                                                    processlines = true;
                                            if (line.startsWith("[test]") || line.startsWith("[prev]")) {
                                                    processlines = false;
                                    retval = true;
                            } catch (Throwable t) {
                    return retval;


            public static void main(String[] args) {
                    if (args.length == 0) {
                            System.err.println("Usage:::::   CygwinCleaner    {full_path_to_setup.ini}    [CLEAN]\nIf only the ini file is specified then a report will be generated\nTo perform the cleanup add the second optional parameter of CLEAN");
                    } else {
                            System.out.print("CygwinCleaner: ");
                            CygwinCleaner cc = new CygwinCleaner();
                            String setupFileName = args[0];
                            if (args.length > 1) {
                                    if (args[1].equalsIgnoreCase("CLEAN"))
                                            cc.doClean = true;
                            if (cc.doClean) {
                                    System.out.println("Performing cleanup\n");
                            } else {
                                    System.out.println("Reporting only\n");
                            File file = new File(setupFileName);
                            if (cc.loadFileList(file)) {
                                    System.out.println("     Total of:" + cc.formatCount(cc.setupFileCount) + " files in setup.ini");
                                    System.out.println("       Source:" + cc.formatCount(cc.srcFileCount) + " files in setup.ini");
                                    System.out.println("      Leaving:" + cc.formatCount((cc.setupFileCount - cc.srcFileCount)) + " files in setup.ini\n");
                                    System.out.println("     Total of:" + cc.formatCount(cc.diskFileCount) + " files in setup directory before cleanup");
                                    System.out.println("      Deleted:" + cc.formatCount(cc.deleteCount) + " files in setup directory (unused)");
                                    System.out.println("      Leaving:" + cc.formatCount((cc.diskFileCount-cc.deleteCount)) + " files in setup directory after cleanup\n");
                                    System.out.println("      Missing:" + cc.formatCount(cc.missingFileCount) + " files in setup directory that are contained in setup.ini");
                            } else {
                                    System.err.println("setup.ini file (" + setupFileName + ") does nofiles in setup");

I have been experimenting with Cygwin attempting to get a "bare-bones", minimal install. I do find that installing utilities like grep, gawk, sed and similar tools has dependencies on cygwin, base-Cygwin and sometimes unwanted tools like bash, coreutils etc., I have not attempted to completely understand why this dependency exists, but that's not my goal. I wanted to get only the tools and their required dlls installed and started examining the Cygwin package. I discovered that not using the setup.exe supplied by Cygwin is an alternative way to accomplish minimal Cygwin installs. And this is how I got it done.

  1. Use the setup.exe supplied by Cygwin to download all the packages - download only and no install.
  2. Once the download is successfully completed, individual packages like zlib, gawk, grep, libiconv are found under the x86/release or x86_64/release directory.
  3. Each package is 'tar'red and compressed using tool 'xz' or bzip and stored in respective directories.
  4. To install a specific tool like sed or gawk, all that needs to be done, is to extract the tool executable and its dependencies (.dll)

    Before you attempt the following, please ensure you have a tool like 7z.exe, xz.exe, bzip2 or other that is capable of uncompressing an .xz or bzip archive

Installing gawk example below :

  1. Extract gawk.exe from gawk-4.1.3-1.tar.xz archive using the command - 7z.exe e -so gawk-4.1.3-1.tar.xz | tar xvf -
  2. Once that is done, you should find gawk.exe in a subfolder usually, usr/bin under the release/gawk folder
  3. Find the dependencies for gawk - you can do this in a couple of ways.

    Examine the Cygwin setup.ini file found in x86 or x86_64 folder. Look for the string '@ gawk' and in the lines after this line you should find a "requires:" line that lists the dependencies.

    Mine reads like this - "requires: bash cygwin libgmp10 libintl8 libmpfr4 libreadline7"

For gawk to run, bash is not a must since we have the windows command shell. (bash is included to get a few other dlls required by gawk. However, that causes a lot more unnecessary files to be installed). The other dependencies contain files that gawk needs to run. Extract each of the above packages using tools like 7z or xz into individual files.

After all the dependencies are extracted, copy your needed tool(s) (grep/sed/gawk) to a folder and all the dependent .dlls You should now be able to run your tool with the minimum set of .dlls required in a bare-bones cygwin installation.

Caution : It may not be sufficient to just extract the dependencies listed in setup.ini for each tool. Sometimes, you may need to execute/run the tool to discover that there are more dlls required.

There are other means of finding out the dlls required by an exe - you can use dumpbin from MS or dependency walker, ndepends or similar tools to find the list of dependent dlls

Consult - https://stackoverflow.com/questions/362560/how-do-i-detect-the-dlls-required-by-an-application https://stackoverflow.com/questions/475148/how-do-i-find-out-which-dlls-an-executable-will-load

I also brute forced the dependent dll info by just running the tool and installing the missing dlls listed one by one by extracting from the required packages.

When you run a exe and if it errors out with a missing .dll message, search for the package that contains the dll here - https://cygwin.com/cgi-bin2/package-grep.cgi . Enter the full/partial name of the missing dll to find the name of the package containing the dll.

Eventually, I have ended up with a bare-bones cygwin install with only the tools and dlls that I need. Example : gawk - gawk.exe and the following dlls - cygwin1.dll, cyggmp-10.dll, cygiconv-2.dll, cygintl-8.dll, cygmpfr-4.dll, cyggcc_s-seh-1.dll, cygncursesw-10.dll, cygreadline7.dll

sed - sed.exe and dlls - cygwin1.dll, cygintl-8.dll

Hope this is found useful. The Cywin installer also does dll re-basing, which I will not venture into here


As a cygwin user i agree with both the prior posts.

NEEDS: grep, sed, awk, cut, diff, comm, vim, OpenSSH, tar, gzip, bash, wget

As for space, I agree with Ian. Small price to pay for space. You can now get a 1TB 10,000 RPM drive for under $100.00. I can remember when we all had to pay over $150.00 for a 20.00 GB drive.

If you are really concerned about local drive space, try to get your self a NAS storage box to sit on your network, and store the "downloaded packages" to it. That will further reduce the footprint on your own machine.

It's really a small price to pay for Cygwin.

  • There are no 10k rpm 1TB drives on the market. The 1TB drives are 5400pm or 7200rpm. Jun 8, 2009 at 23:42
  • correct, i was looking at a WDC drive, Western Digital WDH1Q10000N, and made incorrect assumption.
    – netlinxman
    Jun 9, 2009 at 0:00

Not the answer you're looking for? Browse other questions tagged .