Cygwin installs packages with dependencies by default, often including documentation and rarely-used binaries. The /usr/share/doc
directory alone can consume 300MB+.
For development work, this core set covers 90% of use cases:
bash coreutils curl diffutils findutils gawk git grep gzip less make patch rsync sed tar unzip vim wget zip
During installation or updates:
- Run
setup-x86_64.exe -q
(or x86 for 32-bit) - Select "Install from Internet"
- Change View to "Category"
- Manually expand only needed categories
Safe-to-remove directories:
rm -rf /usr/share/doc/*
rm -rf /usr/share/man/*
find /usr/share/locale -mindepth 1 -maxdepth 1 ! -name 'en*' -exec rm -rf {} +
Edit /etc/fstab
to prevent unnecessary mounts:
none /cygdrive cygdrive binary,posix=0,noacl,user 0 0
List installed packages sorted by size:
cygcheck -cd | sort -k2 -nr | head -20
To remove unneeded packages:
setup-x86_64.exe -q -P -^package1,package2,package3
For rarely-used tools, consider symlinks to a central repository:
ln -s /central_repo/bin/rare_tool /usr/local/bin/rare_tool
Create a cleanup script (~/.clean_cygwin
):
#!/bin/bash
# Remove old package cache
find /setup -name "*.tar.xz" -mtime +30 -delete
# Clear temp files
rm -rf /tmp/*
# Optional: compact package database
sqlite3 /etc/setup/installed.db "VACUUM;"
Cygwin installs with many default packages, some of which may be unnecessary for your workflow. The primary space consumers are:
- /usr/lib - Contains shared libraries (often duplicated across packages)
- /usr/share - Documentation and locale data
- /var/cache - Package download cache
For most development work, these core packages provide maximum utility with minimal footprint:
bash coreutils curl diffutils findutils gawk grep gzip less make patch sed tar unzip vim wget
Add these if you need version control:
git mercurial
To reduce your current Cygwin installation size:
# Remove documentation and locale data
rm -rf /usr/share/doc/*
rm -rf /usr/share/man/*
rm -rf /usr/share/locale/*
# Clear package cache
rm -rf /var/cache/setup/*
# Remove unused compilers and dev tools (if not needed)
cygwin-delete gcc-g++ gcc-core binutils
For new installations, use the --no-admin
flag and select packages manually:
setup-x86_64.exe --no-admin --packages=bash,coreutils,curl,git
Create a cleanup script to run periodically:
#!/bin/bash
# Cygwin cleanup script
echo "Cleaning temporary files..."
rm -rf /tmp/*
echo "Clearing package cache..."
rm -rf /var/cache/setup/*
echo "Removing old documentation..."
find /usr/share/doc -type f -delete
echo "Cleanup complete."
If you're on Windows 10/11 and don't specifically need Cygwin, consider WSL which has better disk management:
wsl --install -d Ubuntu
wsl --set-version Ubuntu 2