How do I install a cygwin package from the command line?

Solution 1:

You should be able to use setup.exe w/o the GUI:

setup.exe -q -n -N -d -R c:\cygwin -s http://yourFavoriteMirror \ 
-l c:\localPackageDir -P  <comma-separated list of packages to install>

This is from cygwin mailing list (and follow up post)

Solution 2:

This question was already asked here. Answer:

wget http://apt-cyg.googlecode.com/svn/trunk/apt-cyg
chmod +x apt-cyg
mv apt-cyg /usr/local/bin/
apt-cyg install bc

Solution 3:

You can run setup.exe again and add/remove package, as well as the first time ;)