upgrading and installing packages through the cygwin command line?

23
2014-04
  • Jared

    I'm a blind computer user that uses Cygwin. The installation program isn't very accessible, upgrading, installing, and removing specific packages is quite hard to do since you have to use simulated mouse keystrokes to click and scroll. Is there a way to either manually install/upgrade packages or install/upgrade them through the commandline?

  • Answers
  • knorv

    Install apt-cyg:

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

    After that you'll be able to install say the package "lynx" including dependencies by running:

    apt-cyg install lynx
    
  • Marc Climent

    The official apt-cyg installation method is:

    # svn --force export http://apt-cyg.googlecode.com/svn/trunk/ /bin/
    # chmod +x /bin/apt-cyg
    

    Two steps is better than three. ;-)

    Then:

    # apt-cyg install nano
    

    By the way, to make it work you will need to install wget, tar, gawk and bzip2 in order to use apt-cyg. Apart from wget, the others come with default Cygwin installation.

  • Moreaki

    Since some people correctly stated that apt-cyg itself needs wget and in order to get apt-cyg you need wget, there is a bash only solution to bootstrap wget in pure bash.

    Create a function like this in your mintty bash shell:

    function __wget() {
        : ${DEBUG:=0}
        local URL=$1
        local tag="Connection: close"
        local mark=0
    
        if [ -z "${URL}" ]; then
            printf "Usage: %s \"URL\" [e.g.: %s http://www.google.com/]" \
                   "${FUNCNAME[0]}" "${FUNCNAME[0]}"
            return 1;
        fi
        read proto server path <<<$(echo ${URL//// })
        DOC=/${path// //}
        HOST=${server//:*}
        PORT=${server//*:}
        [[ x"${HOST}" == x"${PORT}" ]] && PORT=80
        [[ $DEBUG -eq 1 ]] && echo "HOST=$HOST"
        [[ $DEBUG -eq 1 ]] && echo "PORT=$PORT"
        [[ $DEBUG -eq 1 ]] && echo "DOC =$DOC"
    
        exec 3<>/dev/tcp/${HOST}/$PORT
        echo -en "GET ${DOC} HTTP/1.1\r\nHost: ${HOST}\r\n${tag}\r\n\r\n" >&3
        while read line; do
            [[ $mark -eq 1 ]] && echo $line
            if [[ "${line}" =~ "${tag}" ]]; then
                mark=1
            fi
        done <&3
        exec 3>&-
    }
    

    Now you can use it almost like wget:

    __wget http://apt-cyg.googlecode.com/svn/trunk/apt-cyg > /usr/bin/apt-cyg && chmod 0755 /usr/bin/apt-cyg
    
  • user17633

    Cygwin's setup.exe, at least in the 1.7 "beta" release, has an "unattended" mode built-in. Drag and drop your setup.exe shortcut into a command window (or otherwise prepare to run it with switches), and add -q for unattended mode followed by -P and comma-separated package names. So, for me, this installed lynx:

    "C:\Documents and Settings\martind\Desktop\setup-1.7.exe" -q -P lynx

  • peenut

    Old question, but for others that google and got here: Official setup.exe has command line arguments which allowed me to prepare simple *.bat script - just put following line in e.g. "install-pkg.bat" and put that file into your root directory (e.g. C:\cygwin):

    setup.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --root "%cd%" --packages %*
    

    You need to download and put http://www.cygwin.com/setup.exe into the same directory. Now all you have to do to install package is:

    install-pkg packagename
    

    Positive: official setup.exe, should always work, for any package. Negative: current (june/2011) official setup.exe requires administrator rights even though it actually does not need one (e.g. root directory outside system folders).

  • Steven Penny
    setup-x86 -nq -s http://box-soft.com -P curl,git,make
    

    or

    setup-x86 -nq -s http://box-soft.com -P curl -P git -P make
    

    This will install cURL, git, and make, with no shortcuts in quiet mode.

  • LunchMoney

    I found two 'apt like' package managers for cygwin. One is a python script called cyg-apt which you can download from http://www.lilypond.org/~janneke/software/cyg-apt and the other is apt-cyg which you can find at http://code.google.com/p/apt-cyg/


  • Related Question

    Installing latest version of a package on cygwin?
  • Jared

    I want to run Emacs 23 on Cygwin, but when I install cygwin only emacs21 gets installed. How can I upgrade my existing Cygwin install to use Emacs23? I know emacs 23 is available since it's listed at this link. http://cygwin.com/packages/emacs/


  • Related Answers
  • 8088

    When you're in the "Select Packages" step of Cygwin Setup:

    1. Click on the value in the New column (it will cycle through the install options) in the emacs row
    2. Select latest version of emacs (you may also have to check the box in the "Bin" column)

    Cygwin Select Packages

    One thing I noticed is that once emacs 23 is installed, Cygwin doesn't give you the option to uninstall it. I had to install emacs 21 and then it allowed me to remove emacs.