How to Install Cygwin Packages via Command Line (Equivalent to apt-get install)


5 views


While Cygwin doesn't have an exact equivalent to Linux's apt-get, it provides several powerful command-line tools for package management.

The primary way to install packages after initial installation is through Cygwin's setup-x86_64.exe (or setup-x86.exe for 32-bit):

setup-x86_64.exe -q -P git

Where:

  • -q enables quiet mode
  • -P specifies the package to install

Install multiple packages:

setup-x86_64.exe -q -P git,vim,python3

List available packages:

setup-x86_64.exe -q -L | grep git

Search for packages:

setup-x86_64.exe -q -s "development"

Some users prefer the apt-cyg wrapper that provides apt-like syntax:

# First install apt-cyg
lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg
install apt-cyg /bin

# Then use like apt-get
apt-cyg install git

For scripting purposes, you can create a batch file:

@echo off
set CYGWIN_PACKAGES=git,vim,curl
setup-x86_64.exe -q -P %CYGWIN_PACKAGES%

After installation, verify packages are properly installed:

which git
git --version

Remember that Cygwin packages install into /usr/bin by default, which is automatically added to your PATH.


Unlike traditional Linux package managers, Cygwin requires a different approach for post-installation package management. The setup-x86_64.exe (or setup-x86.exe for 32-bit) is actually Cygwin's package manager in disguise.

Here's how to install packages after initial installation:

setup-x86_64.exe -q -P git,vim,curl

Key parameters:

  • -q: Quiet mode (no GUI)
  • -P: Specifies packages (comma-separated)

Installing development tools:

setup-x86_64.exe -q -P gcc-core,gcc-g++,make,gdb,git

Adding Python environment:

setup-x86_64.exe -q -P python3,python3-pip,python3-devel

To search for available packages:

setup-x86_64.exe -q --search git

To list installed packages:

setup-x86_64.exe -q --list-installed

You can specify alternative mirrors:

setup-x86_64.exe -q -P git -s http://mirror.example.com

For repeatable installations, create a batch file:

@echo off
SET CYGWIN_PACKAGES=git,vim,curl,gcc
setup-x86_64.exe -q -P %CYGWIN_PACKAGES%
  • Always run as Administrator
  • Check your PATH if commands aren't found after installation
  • Use --no-shortcuts to avoid desktop shortcuts