Cygwin: The Windows Developer's Dream
If you've ever come across a tool for web development that benefits from the unix/linux/osx terminal, then you understand the frustration of developing on Windows. The command line just isn't the same thing, and while you can get some basic tools to run on it, you'll still be missing out on several helpful commands and capabilities. And if you haven't, because you've always worked on a Mac or in Linux, then this article isn't necessarily for you, but you might learn something beneficial.
Cygwin describes itself as:
a large collection of GNU and Open Source tools which provide functionality similar to a Linux distribution in Windows.
a DLL (cywing1.dll) which provides substantial POSIX API functionality.
You may know exactly what they're saying. I, however, do not. I've played with Linux in my spare time, I've set up a development server in Linux for personal use, but a lot of the terminology is lost on me. How I understand it is that you get some of tools for interacting with your documents and code that are similar to Linux. I'm talking 'mkdir, touch, cd," etc. If that is new to you, you can probably Google "Linux Basic Commands," but I find this document to be pretty helpful. But, in addition to that, they provide a collection of other tools and libraries that are not baked in, but at your disposal. So, if you want to use PHP, or run Vim, or use Git from a terminal-like interface, you're in luck.
I should note that you can do these things in Windows too. The idea isn't that this gives you all brand new tools you can't use natively on Windows (there are those too), but that it also gives the ability to use some common tools like Vim or Git from a Linux-style terminal.
Enough talk: here's how to get started.
First, go to the install page on the Cygwin website and download the .exe that corresponds to your version of Windows.
Run the .exe and be sure to choose "Install From Internet." This will tell Cygwin to download the most recent version of itself. When choosing where to install, I recommend installing as close to the root of the drive as possible. So, for me, the root directory is D:\cygwin64. Because you will be working with files OUTSIDE of the Cygwin directory sometimes, you want to be able to jump out at a reasonable place each time.
For the local package directory, choose somewhere where you don't mind storing files. It is recommended that you store it outside of the cygwin install folder because you want to keep that directory clean for the simulated linux environment. I just store it in my downloads folder, because that's a place I don't mind having extraneous files.
If you are connected to the internet via Ethernet or Wi-Fi, and you don't have any super specific network settings, you can just continue. Select any mirror, I choose the first one usually. Then, Cygwin will download the most recent list of packages.
Now, this area can be VERY confusing if you're not used to downloading packages in Linux, or if you don't know what you need. For this demonstration, I'm going to assume that you want to be able to use virtual machines in Vagrant, as well as use Git for version control and Vim for quick file edits.
So, using the Search field at the top, first search for SSH. Your options should be reduced quite a bit. Open the "Net" folder and check "libssh2_1:SSH2 protocol library" and "openssh: The OpenSSH server and client programs." If you are worried about Heartbleed, don't be here: Heartbleed affects OpenSSL, not OpenSSH. They are two entirely different packages.
Next, using the Search field, search for Vim. Under Editors, select "vim: Vi IMproved - enhanced vi editor" and "vim-common: Vi IMproved - enhanced vi editor (common runtime)". You can also install the "gvim" if you want a GUI for Vim. I don't intend to use Vim from here as my exclusive editor, so I'm not too worried about it.
Next, search for Git. Under Devel, select "git: Distributed version control system", "git-completion", and "git-svn". You can download any of the other packages in the Devel folder related to Git if you want to extend the functionality. I find that I can get by with these three packages.
Finally, search for PHP. Instead of opening the PHP folder, just click it until it says "Install" next to it. You will not need everything most likely, but there are issues with tools like Composer that are easily avoided by just having everything related to PHP at your disposal.
If there are any other packages you wish to download, now is a good time to do so. If you have no idea, don't worry. You can rerun the installer at any time, and it functions as your updater and packaged manager. That means, every time you run the Cygwin .exe, you will download the most recent version of Cygwin as well as the most up-to-date list of packages. If you keep your keep your local package directory, it will remember everything that you have installed, allowing up to update all of those packages without touching them, or uninstall/reinstall if you have any issues. Linux users will be used to things like "apt-get" for downloading packages. You can set up something similar in Cygwin, but the work vs reward has not been worth it for me yet.
Once you are satisfied with your packages, click Next, and let the installer run. If this is the first time running, it will take a good amount of time, as you are downloading a lot of material. Don't worry, it's not going to fill up your hard drive, a lot of this stuff is pretty lightweight.
After it has finished, you can put a link on your desktop. When you open the program, you'll see a terminal very familiar to Linux and Mac users.
For the purposes of this guide, I'm going to say we're done. There's still plenty that can be done, including setting up Vagrant. But we'll save that for another time. Right now, play around with Cygwin. Open up the install directory and take a look around. If you're familiar with Unix architecture, you should see a lot of familiar folders.
One last tip. If you need to jump out of the Cygwin pseudo-Linux environment, you'll want to cd to "/cygdrive/d/". This will place you at the Windows D:/ directory. Or, if you've installed it on a C: drive, just replace the "d" with a "c".
Hope this helps. Any questions?