To Use or Not to Use Cygwin

Yes, if you just want to use those neat Unix utilities, like grep, head, touch, tail, more, etc, and if you are patient enough to manage Cygwin installation. For anything beyond that, you should really consider Solaris x86 or Linux.

Cygwin installer is my worst install experience. After using Cygwin for years, I still find it confusing and tiresome to check/uncheck these little source/binary/remove icons.

I wouldn't run any serious apps, not even Apache Ant, from within a Cygwin shell. I don't need more dll mismatches, or path configuration problems. I don't want to duplicate all my environment variables (JAVA_HOME, ANT_HOME, MAVEN_HOME, CATALINA_HOME, JBOSS_HOME, SJSAS_HOME, etc) in both Windows Control Panel and .profile/.bash/.tcsh. I don't want to rewrite my convenience batch files to tcsh alias or bourne shell scripts.

I wouldn't build my projects using any part of Cywin. I wouldn't require team members to have Cygwin in their Windows box. Of course, I would never ask end users of my software to first install Cygwin, or some other Unix clone on Windows. If any software product have such requirement, I have doubt on its quality and maintainability.

If my development environment is Windows, I would hire a release engineer good at batch files, or even better, an Ant expert.


Weiqi Gao said...

I've also been using Cygwin for years. I do almost everything in Cygwin: I run the X server and multiple xterms. Ant works just fine under such an environment. The $ANT_HOME/bin/ant shell script contains special Cygwin code for manipulating the CLASSPATH environment variable.

I can start a Windows command prompt from within bash and it will inherit all the exported enviromnent variables with proper conversions (for example, PATH will be converted back to Windows style.) It really poses no problems.

The only drawback of using Cygwin in a team where others don't use it is when something goes wrong. At such times I invariably have to open a Windows command prompt and verify that the problem is not caused by Cygwin per se. And in my experience Cygwin has never been the culprit of any of the problems.

There are other small things that I have to constantly on the watch while using Cygwin: The Cygwin cvs command tells the repo that its a Unix, so the checked out files all have Unix line endings. I do have to convert paths from Cygwin to Windows from time to time. Cygwin has its own jar, rmic, rmiregistry commands from Gcj. But these are the price I have to pay to use Cygwin and in my case the convenience of Cygwin outweigh these small annoyances. Of course YMMV.

howto said...

Thanks for sharing your experience.

Toast said...

You don't have to mirror your env variables in the control panel. If they are set up in sys->env vars, restart your cygwin prompt and type set. You will see them there, unless there's something in your env that I am missing?

howto said...

You must be using bash. I happen to use tcsh in cygwin. I have JAVA_HOME set to C:\tools\jdk5 in DOS. env command in tcsh shows the same JAVA_HOME value (C:\tools\jdk5), but 'echo $JAVA_HOME' shows "C: ools\jdk5" Apparently, \t in C:\tools is interpreted as tab.

To avoid this, I usually set these environment variables in .tcshrc, too.

Anna said...

Great and Useful Article.

Online Java Training

Java Online Training India

Java Online Course

Java EE course

Java EE training

Best Recommended books for Spring framework

Java Interview Questions

Java Course in Chennai

Java Online Training India