78

How can I completely uninstall/remove cygwin? I don't think it is as simple as deleting C:\cygwin. Maybe alter registry?

1

10 Answers 10

66

The developers give fairly detailed instructions on how to remove the software:

How do I uninstall all of Cygwin?

Setup has no automatic uninstall facility. The recommended method to remove all of Cygwin is as follows:

  1. If you have any Cygwin services running, remove by repeating the instructions in http://cygwin.com/faq/faq.html#faq.setup.uninstall-service for all services that you installed. Common services that might have been installed are sshd, cron, cygserver, inetd, apache, postgresql, and so on.

  2. Stop the X11 server if it is running, and terminate any Cygwin programs that might be running in the background. Exit the command prompt and ensure that no Cygwin processes remain. Note: If you want to save your mount points for a later reinstall, first save the output of mount -m as described at http://cygwin.com/cygwin-ug-net/using-utils.html#mount.

  3. Delete the Cygwin root folder and all subfolders. If you get an error that an object is in use, then ensure that you've stopped all services and closed all Cygwin programs. If you get a 'Permission Denied' error then you will need to modify the permissions and/or ownership of the files or folders that are causing the error. For example, sometimes files used by system services end up owned by the SYSTEM account and not writable by regular users.

    The quickest way to delete the entire tree if you run into this problem is to change the ownership of all files and folders to your account. To do this in Windows Explorer, right click on the root Cygwin folder, choose Properties, then the Security tab. If you are using Windows XP Home or Simple File Sharing, you will need to boot into Safe Mode to access the Security tab. Select Advanced, then go to the Owner tab and make sure your account is listed as the owner. Select the 'Replace owner on subcontainers and objects' checkbox and press Ok. After Explorer applies the changes you should be able to delete the entire tree in one operation. Note that you can also achieve this in Cygwin by typing chown -R user / or by using other tools such as CACLS.EXE.

  4. Delete the Cygwin shortcuts on the Desktop and Start Menu, and anything left by setup.exe in the download directory. However, if you plan to reinstall Cygwin it's a good idea to keep your setup.exe download directory since you can reinstall the packages left in its cache without redownloading them.

  5. If you added Cygwin to your system path, you should remove it unless you plan to reinstall Cygwin to the same location. Similarly, if you set your CYGWIN environment variable system-wide and don't plan to reinstall, you should remove it.

  6. Finally, if you want to be thorough you can delete the registry tree Software\Cygwin under HKEY_LOCAL_MACHINE and/or HKEY_CURRENT_USER. However, if you followed the directions above you will have already removed everything important. Typically only the installation directory has been stored in the registry at all.

5
  • 1
    I originally found these instructions at the source that John T linked to and tried them on Windows 7. They didn't work for me. Has anyone gotten them to work on Windows 7? I wasn't able to delete the C:\Cygwin directory, even after booting into safe mode with a command prompt. Aug 6, 2011 at 13:39
  • 4
    Thanks, this worked for me. Every couple of years I get to a point where I think cygwin might be useful and that it can't be as useless as I remember it (today I wanted to do a bit of Lisp hacking). Then after installing it and wasting about two hours because nothing works and there is no documentation I get this horrible feeling of deja vu and remember that it is virus-like in its difficulty to remove from your machine. Ubuntu under VMWARE seems like a much better option.
    – user81238
    Jan 21, 2012 at 11:03
  • 1
    I had to do more than just change the owner in order to delete, I also had to change the permissions to be more permissive (basically let everyone have full access). This is the permissions tab next to the owner tab. Cygwin: not even once.
    – mrmagooey
    Oct 2, 2013 at 3:33
  • 1
    The command you indicate (chown -R user /) is NOT the equivalent of changing ownership of the Cygwin folder. It will modify the ownership of ALL files on the filesystem.
    – piwi
    Feb 7, 2014 at 9:17
  • 1
    @piwi, from within a cygwin shell, the / folder is the root of the cygwin folder, not the windows system volume "root". That command will not modify ownership of all files on the windows system filesystem. May 3, 2018 at 12:15
48

Actually it was rather... easy. Just do this...

takeown /f C:\cygwin /r /d y
icacls c:\cygwin /t /grant everyone:F
del c:\cygwin

then just right click delete it . it'll be gone.

7
  • 2
    My two cents: - These commands have to be executed with administrative privileges ("Run as Administrator"). - If some files cannot be deleted, use a tool like Unlocker to get rid of them. - At the end use a Registry cleaner tool (e.g. CCleaner) to remove residual Registry entries. May 15, 2018 at 16:04
  • 3
    Also C:\cygwin64 for the 64-bit version
    – Drakes
    Jul 20, 2019 at 21:18
  • 1
    del didn't work for me, I used Remove-Item "C:\cygwin64" -Recurse -Force
    – olfek
    Jan 5, 2020 at 15:47
  • 1
    then in the registry I deleted Cygwin in Software\Cygwin under HKEY_LOCAL_MACHINE and/or HKEY_CURRENT_USER (as mentioned above).
    – JinSnow
    May 27, 2020 at 17:32
  • @daka most likely you're running a powershell session
    – Luigi
    Nov 18, 2022 at 10:40
17

Follow the below steps.

  1. C:\>takeown /r /d y /f cygwin
  2. C:\>icacls cygwin /t /grant Everyone:F
  3. C:\cygwin\bin>.\cygrunsrv.exe -E sshd
  4. C:\cygwin\bin>.\cygrunsrv.exe -R sshd

Then delete the folder c:\cygwin and all its sub-folders. This approach worked for me.

Be aware that windows commands like takeown are depending on the locale, i.e. option /d y works only in english systems. In german system one needs to use /d j to work (without hint in the english help, *facepalm microsoft)*

1
  • 2
    Also only icacls cygwin /t /grant Jeder:F worked for me on my german system
    – jhasse
    Oct 12, 2016 at 17:18
6

I did this in Win 7 after trying everything possible from within Win 7 (note... I have been able to disable rootkits easier than delete CygWin!!)

  1. C:\>takeown /r /d y /f cygwin

    Only worked for one folder ('var' I think)

  2. C:\>icacls cygwin /t /grant Everyone:F

    worked

  3. C:\>takeown /r /d y /f cygwin

    repeating this command worked after the above (second) command!!

  4. C:\cygwin\bin>.\cygrunsrv.exe -E sshd

    gave access denied

  5. C:\cygwin\bin>.\cygrunsrv.exe -R sshd

gave access denied

BUT I then went to Windows explorer and deleted (recycled) the C:\Cygwin folder and it worked. Gone completely.

Thanks to the above post! Hope this helps somebody.

3

In addition to Luigi's answer,

icacls c:\cygwin /t /grant everyone:F

In localized Windows there's no security group with name "everyone", you should replace a group name by a correspondent SID:

icacls cygwin /t /grant "*S-1-1-0":F

More SIDs are here.

1

I had trouble in deleting Cygwin folder and I have traversed the entire directory structure and deleted each sub-folder. This is really painful, but no other choice.

1

I didn't see it mentioned on here but if anyone still can't remove the C:\cygwin folder because it is in use, check for the service 'Server' on your computer. It's not a part of Cygwin, but I saw that it is used for named-pipe sharing, and I was able to delete the Cygwin folder when I stopped it.

Just FYI

1

Launch the Cygwin installer and goto to package viewer and select view as a category and install type as uninstall ... Done.

1
  • 1
    Welcome to Super User! Please read the question again carefully. Your answer does not answer the original question. This uninstalls only packages not the whole of cygwin.
    – DavidPostill
    May 13, 2018 at 17:05
0

Well, none of that worked, so here's what I did:

  1. Set owner to whatever user you are, as described above.
  2. Delete all users from folder permissions in Security-Edit.
  3. Re-add your user and set full control permissions.
  4. Go to Advanced and select both checkboxes at the bottom (Include ineritable permissions..., Replace all child object permissions..., blahblahblah).
  5. Apply the changes.
  6. Simply delete the folder. Should work.
1
  • Can you please format your question. It would make a helpful question that is extremely hard to read into a question that was helpful.
    – Ramhound
    Feb 9, 2015 at 14:11
0

I followed this guide

https://cygwin.fandom.com/wiki/Uninstalling_Cygwin

and worked fine

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .