Home > bash, cygwin > Install and maintain Cygwin without Windows admin rights

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.

Categories: bash, cygwin Tags: ,
  1. November 2, 2018 at 03:07

    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

  2. October 28, 2014 at 03:04

    The flag is actually --no-admin ,that’s two dashes

    • October 28, 2014 at 18:45

      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. August 21, 2014 at 20:31

    Yes, that worked great. Thanks!

  4. August 15, 2014 at 10:12

    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!

    • August 15, 2014 at 10:28

      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?

      • August 15, 2014 at 10:38

        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

      • August 16, 2014 at 21:51

        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

  5. Robert
    May 13, 2014 at 12:25

    command prompt is disabled by administrator. What to do now?

  6. April 16, 2014 at 08:16

    how do I run with the ‘no admin’ option?

    • April 17, 2014 at 17:16

      Start cmd.exe and run the cygwin setup executable with the --no-admin option.

  7. techraisin
    January 17, 2014 at 06:38

    Great write-up! Thanks!

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: