Search code examples
installationcygwin

Can I script a Cygwin install to include certain packages?


I install cygwin frequently enough that it would be handy to have the process automated. Specifically, I want to be able to specify ahead of time the packages that I want to install, so that I don't have to remember them at install-time. Is there any way to do this?


Solution

  • Yes, you can. Assuming you haven't installed Cygwin yet, bash isn't available, so you have to use a CMD script. Here's an example:

    setup-x86.exe ^
    --quiet-mode ^
    --packages ^
    aria2,^
    atool,^
    autoconf,^
    ...
    xmlstarlet,^
    zip
    

    and add other packages to the list. The caret (^) character at the end of every line is the line continuation character in CMD scripts. The list of package names is comma-delimited, which is what the --packages option expects, although that's not documented.

    You can run setup-x86.exe --help, or see the Cygwin FAQ, to read about the available command line options for setup.

    If you name this script, say, setup.bat or setup.cmd, and put it in the same directory as setup-x86.exe, then you can run it to get a one-click install of Cygwin with all of the packages you want.

    Note also that you'll have to specify the --site and --root options for a fresh install, or it will kick out of "quiet mode" and prompt the user anyway.