Search code examples
ruby-on-railswindowscurllibcurlrubymine

How to solve 'libcurl' not found with Rails on Windows


This is giving me a headache. I'm continuing a Rails project that started on Linux and I keep getting this when I run Puma on Ruby Mine:

Error:[rake --tasks] DL is deprecated, please use Fiddle
rake aborted!
LoadError: Could not open library 'libcurl': The specified module could not be found.
Could not open library 'libcurl.dll': The specified module could not be found.
Could not open library 'libcurl.so.4': The specified module could not be found.
Could not open library 'libcurl.so.4.dll': The specified module could not be found.
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/ffi-1.9.14-x86-mingw32/lib/ffi/library.rb:147:in `block in ffi_lib'
[...]

Now, what have I tried?

  • I installed Puma successfully on Windows following this steps
  • I downloaded curl-7.50.1-win32-mingw and put it on "C:/curl"
  • I added C:/curl/bin and C:/curl/include to PATH
  • I installed successfully curb gem with gem install curb --platform=ruby -- --with-curl-lib=C:/curl/bin --with-curl-include=C:/curl/include
  • I put the .dll files in Ruby bin folder, installed the certificate in curl/bin and even run the curl.exe just in case.

I rebooted the machine but I keep seeing the same error.

I do not know what to do. How to successfully install libcurl on Windows for use with Rails


Solution

  • Answer that worked for me (W10/Ruby2.6.0) was:

    1. Download cURL from the following URL: https://curl.haxx.se/windows/ (I chose 64bit because that's the system I'm using)
    2. Go into the archive and browse to /bin
    3. Locate libcurl_x64.dll (it may be just libcurl.dll)
    4. Extract to your local drive
    5. Rename it to libcurl.dll if it has the _x64 suffix
    6. Cut + paste the file into the /bin directory of your Ruby installation