Install and maintain Cygwin without Windows admin rights

Sometimes you work on Windows as a restricted user, without admin rights. Like many other good software packages, Cygwin can be installed anyway (see the respective FAQ entry).

These are the steps I used:

  1. Download setup-x86.exe (32bit) or setup-x86_64.exe (64bit).
  2. Run it with the “--no-admin” option
  3. During installation select the “wget” package
  4. Create /usr/local/bin/cygwin-setup.sh (for 32bit omit the “_64”):
    #! /bin/sh
    rm setup-x86_64.exe
    wget http://cygwin.com/setup-x86_64.exe
    chmod u+x setup-x86_64.exe
    run ./setup-x86_64.exe --no-admin
    
  5. Make the script executable:
    chmod ugo+x /usr/local/bin/cygwin-setup.sh
  6. Create a copy of the Cygwin terminal shortcut, rename it “Cygwin setup”
  7. Edit the shortcut target, replace
    mintty.exe -i /Cygwin-Terminal.ico -

    with

    mintty.exe -i /Cygwin-Terminal.ico /bin/bash -l -c 'cygwin-setup.sh'

Whenever you want to run the Cygwin installer to install or remove packages, you can just execute the shortcut or run cygwin-setup.sh from the Cygwin command prompt.

Alternatively, you could also use the pure command-line tool apt-cyg.

18 thoughts on “Install and maintain Cygwin without Windows admin rights

  1. with disallowed creation of symlinks the certificates cannot be installed and thus the whole cygwin breaks down :(

  2. Late cominging across this but it seems like a great solution! I’m having trouble with the script and shortcut – specifically the wget command. The connection keeps timing out, but when I copy and paste the URL into the web browser on my windows machine there is no issue getting a download dialog to pop up.

    The output of the wget command at the terminal is as follows:

    $ wget ‘http://cygwin.com/setup-x86_64.exe’
    –2018-11-02 17:03:00– http://cygwin.com/setup-x86_64.exe
    Resolving cygwin.com (cygwin.com)… 209.132.180.131
    Connecting to cygwin.com (cygwin.com)|209.132.180.131|:80… failed: Connection timed out.
    Retrying.

    –2018-11-02 17:03:22– (try: 2) http://cygwin.com/setup-x86_64.exe
    Connecting to cygwin.com (cygwin.com)|209.132.180.131|:80… failed: Connection timed out.
    Retrying.

    –2018-11-02 17:03:45– (try: 3) http://cygwin.com/setup-x86_64.exe
    Connecting to cygwin.com (cygwin.com)|209.132.180.131|:80…

    Any assistance you could provide is much appreciated!

    Cheers Mike

      1. Thanks very much for the response. Looks like other URLs are no good either. I’m on a work machine which is through a proxy, so I suspect you are correct. I’ll have a closer look into it!

    1. Thanks for pointing this out. All the code samples in the comment actually use two dashes. But somehow the WordPress font and/or theme seems to display it as single quote. I just fixed all related comments using “code” xhtml tags.

  3. I’ve tried a couple different versions of your script, and it works fine if I run it from within cygwin. Startup also starts-up just fine if I remove either the ampersand or the nohup from your command line.

    But if I leave both, or just have a script with this line:
    nohup ./setup-x86_64.exe --no-admin &

    then, a script window appears briefly, goes away, but cygwin setup doesn’t start.

    Any thoughts you have would be appreciated!

    1. More info…

      if I add a sleep 5s to the next line, setup-x86_64.exe starts as expected… and then disappears after five seconds.

      So it’s as if nohup is being ignored? Any ideas?

      1. Meanwhile, this .cmd file works and exits the batch file. But I’d really like to understand why nohup doesn’t seem to be working as expected?

        c:\
        cd c:\users\%username%\downloads
        rm setup-x86_64.exe
        c:\cygwin64\bin\wget http://cygwin.com/setup-x86_64.exe
        c:\cygwin64\bin\chmod u+x setup-x86_64.exe
        start setup-x86_64.exe --no-admin

      2. The nohup approach works for me so I don’t know what is going wrong for you.
        However, I modified my script in the blog post to use the Cygin “run” command.
        Can you try if that works for you?

        Thanks
        Oliver

Leave a reply to cheitzig Cancel reply