Skip to content

Windows Installation Gotchas

vais edited this page Sep 28, 2014 · 2 revisions

The biggest gotcha in getting the dynamics_crm gem installed under Windows is installing one of it's core dependencies - the curb gem.

The process of installing curb involves building a native extension. If you have not already installed DevKit from RubyInstaller.org, you will need to get it installed and working on your system before installing any gems that depend on building native extensions. To get started, download DevKit, and follow these step-by-step installation instructions.

With DevKit installed and working properly, you are almost ready to install curb. But first, we must take care of one more pre-requisite - curb depends on libcurl being available on your machine, so we will have to download that, and let curb know where to find it. Let's do that next.

Downloading libcurl can be confusing because of a plethora of systems it supports and versions for every OS and hardware combination out there. In addition, since curl is both a command-line tool and a library, there are different downloads available depending on what you are planning to do with it. To save you some time, here is a direct link to download libcurl that we will need to build the curb gem on Windows: http://curl.haxx.se/gknw.net/7.33.0/dist-w32/curl-7.33.0-devel-mingw32.zip

Sidebar: You may notice that this libcurl download is for the 7.33.0 version, and there is at least one more recent version 7.34.0 available already. The reason we will be using the 7.33.0 release is because of a known issue with SSL in 7.34.0 ("Unsupported SSL protocol version" error). I did get bitten by this SSL problem in 7.34.0 trying to get dynamics_crm to connect, but keep in mind that this issue may well be resolved in a newer version of libcurl by the time you are reading this page, so do try newer versions - at least you will be able to recognize the problem if you run into it and downgrade as needed.

Once you download the libcurl zip file, unpack it into a permanent location somewhere on your hard drive. Unfortunately, even after the curb gem is built and installed, it will need to be able to find this libcurl installation directory (i.e. the bin directory inside the libcurl installation will need to be in your PATH - more on that below).

Now that libcurl is installed, we can finally install and build the curb gem! The command to do so will be a little more complicated than what you are used to when installing gems, because we will need to tell rubygems where to find libcurl in order to compile curb native extension. Here it goes - just copy and paste it exactly as it appears here (trust me, you need that weird extra -- in there), but remember to change the file paths to match the location of your libcurl installation:

gem install curb -- --with-curl-lib=C:\curl-7.33.0-devel-mingw32\bin --with-curl-include=C:\curl-7.33.0-devel-mingw32\include

If all goes well, you now have curb installed, so installing dynamics_crm should now be as simple as:

gem install dynamics_crm

Last but not least, you must add the bin directory of libcurl (e.g. C:\curl-7.33.0-devel-mingw32\bin) to your system's PATH environment variable. There are at least 3 ways to do this, neither one of which is particularly pleasant, but c'est la vie:

  1. Update your PATH environment variable through the Windows GUI (right-click My Computer -> Properties -> Advanced -> Environment Variables -> find the PATH environment variable and append ;C:\curl-7.33.0-devel-mingw32\bin to it.
  2. Update the PATH environment variable directly in the command shell each time you launch it, before running the code that uses dynamics_crm gem: e.g. C:\>set PATH=%PATH%;C:\curl-7.33.0-devel-mingw32\bin
  3. Set it in your ruby application using the ENV hash like so: ENV['PATH'] += ";C:\\curl-7.33.0-devel-mingw32\\bin"

That's all folks!

Special thanks to:

Clone this wiki locally