Thursday, October 14, 2010

Cygwin: Update your packages / Install a new one in less than 5 minutes

[what is cygwin? like unix for windows. a better shell and command line.]
Actually, it's the same way you _install cygwin_ ..
Just faster because you don't have to download as much.

If you're installing cygwin for the first time, installing a single missing package,
or updating your install to the latest version, it's the same.
  1. Run cygwin's setup.exe -- the same one you used to install cygwin.
    This took me 2 minutes, because I couldn't remember where I put it.
    Better: just go to and click the Install or update Cygwin now! link and you'll have the latest installer.
  2. click, click, click, just click through, all your previous settings were saved.
    List of mirrors is downloaded
    Pick a new mirror if you want. I used to think http: servers provided better downloads, but now I think they just hang more often. Use http: only if ftp: doesn't work for you (e.g. problems with ftp because you're behind a firewall).
  3. The list of packages is downloaded. This should be pretty quick; if you don't see any activity within 15 seconds or so, cancel and go back to 1.
  4. Select / search for the package(s) you want. Just type in the search area (e.g., cygrun) to find the package and select for install.
    (? if you don't know the package name.. where is a search for files ?)
    old ones are updated automatically ?
  5. Click next to install. All the package(s) are downloaded and installed.
    If it hangs, cancel and go back to 1. Maybe try a new mirror?
  6. "Can't install , file is in use" -- this can happen if
    1. you are running the .exe; for example, bash.exe and you have a bash.exe window open
    2. you are updating a .dll which is in use by your exe or service
    3. service is running, such as sshd. Do this:
    • open a cmd window
    • find the service(s) with the following command:
      net start | findstr /i cyg
      the service(s) names are printed
    • stop the service with
      net stop "CYGWIN sshd"
      replace with the name you have. (? other services besides CYGWIN ?)
    • click Retry on the dialog warning box
    • It should continue now. When you get to the end, remember to restart with
      net start "CYGWIN sshd"
      This is a generally useful way to stop/start services easily from the command line or from a script. If you prefer the slow way of clicking, you can run services.msc
  7. Finished!
    after updating my 1.5.x to 1.7.x, I get this for the cygrund package:
    Postinstall script errors
    Package: No package exit code 1
    I got something like this when I first updated, but I haven't noticed any problem.
Actually, it could take more than 5 minutes, if there are slow downloads.
Once you get the hand of it though, it will probably only take two minutes to grab a missing package.

Because updating/adding a package is so easy, the first time you should click through and accept the defaults, then later adding missing features. I used to spend a lot of time going through all the packages, trying to decide if someday it might be useful. This just takes up more space, and more time later when upgrading.

Enhanced by Zemanta

1 comment:

Sahiib Singh said...

Hey Thanks for the tutorial :) I am a NOOB in cygwin, you helped me in updating cygwin Thanks once again :) Have a great day !