Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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

share|improve this answer
I wonder if there's a way to regularly delete the tmp folder? – CMCDragonkai May 14 '14 at 8:20
@CMCDragonkai, A simple self-script would do? – Pacerier Oct 15 '15 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.

share|improve this answer
"Laptop"? Are you running a actual proper multi-user server on a laptop? – Pacerier Oct 15 '15 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.

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer
I've already deleted the leftover SP MSIs, and I use WinDirStat often to trim cruft. Thanks for the suggestions :) – Chris Marasti-Georg Jul 13 '09 at 17:08

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

share|improve this answer

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.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");
share|improve this answer

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.

share|improve this answer
There are no 10k rpm 1TB drives on the market. The 1TB drives are 5400pm or 7200rpm. – Brian De Smet Jun 8 '09 at 23:42
correct, i was looking at a WDC drive, Western Digital WDH1Q10000N, and made incorrect assumption. – netlinxman Jun 9 '09 at 0:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.