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.

Advertisements
Categories: bash, cygwin Tags: ,
  1. techraisin
    January 17, 2014 at 06:38

    Great write-up! Thanks!

  2. 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.

  3. Robert
    May 13, 2014 at 12:25

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

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

    Yes, that worked great. Thanks!

  6. 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.

  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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: