0

Okay so I've been having a heck of a time getting my IDE environment setup for Ruby and RoR. Every issue so far I've been able to solve except one so I humbly ask the mighty stackoverflow for guidance.

MY RubyMine install is having trouble recognizing some installed gems or more specifically, SQLite3, Mysql, and Mysql2. Using Gem quick install on RubyMine fails on all three, however, installing the gems with the proper config is successful in cmd. While that is successful, RubyMine cannot or will not recognize the installed gems. The 'require mysql2' (with 'require rubygems' placed before it) fails right out of the gate with RubyMine stating that it cannot load such a file. When accessing the RoR server on localhost through firefox, I get an error stating that the gem is not loaded and I should add it to my Gemfile ( I should state at this point that all the above gems were already in the gemfile and if not I added them and ran bundle install) which is confusing. I've spent days scouring the interwebs and stackoverflow for a solution but nothing seems to work. I even tried going from the 64 version of ruby 2 to the 32 bit version and some previous versions.

on a side note, would it be easier to code ruby in a linux distro? (like Ubuntu)

Currently I am using RubyMine 5.4 IDE on Windows 8x64 within a custom rig. I have three Ruby SDK's to use: 2.0x64PO, 2.0PO, and 1.9.3 and have the most current version of Rails installed. Rubygems is installed along with the most recent versions of SQLite3, mysql, and Mysql2 installed correctly with manual install.

below is a copy of the error I get within rubymine when trying to run.

runnerw.exe C:\Ruby200\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) C:/Users/RocYourSockx/RubymineProjects/testerrails/bin/rails server -b 127.0.0.1 -p 3000 -e development
C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.rb:2:in `require': cannot load such file -- mysql2/2.0/mysql2 (LoadError)
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.rb:2:in `<top (required)>'
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2.rb:9:in `require'
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2.rb:9:in `<top (required)>'
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
    from C:/Users/RocYourSockx/RubymineProjects/testerrailsnigga/config/application.rb:7:in `<top (required)>'
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0.rc1/lib/rails/commands.rb:78:in `require'
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0.rc1/lib/rails/commands.rb:78:in `block in <top (required)>'
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0.rc1/lib/rails/commands.rb:75:in `tap'
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0.rc1/lib/rails/commands.rb:75:in `<top (required)>'
    from C:/Users/RocYourSockx/RubymineProjects/testerrailsnigga/bin/rails:4:in `require'
    from C:/Users/RocYourSockx/RubymineProjects/testerrailsnigga/bin/rails:4:in `<top (required)>'
    from -e:1:in `load'
    from -e:1:in `<main>'

Process finished with exit code 1
  • 1
    Maybe this question can help you: http://stackoverflow.com/questions/15604058/error-cannot-load-such-file-mysql2-2-0-mysql2-loaderror-on-windows-xp – Mindbreaker May 08 '13 at 12:53
  • 1
    This is not really an answer, so i'll use comments. I gave up doing rails on windows a long time ago. Instead i launch a VM (VMWare player) with ubuntu and a samba share. My project files are in the shared folder and i can edit them with sublime text on windows, while accessing terminal in my VM. I gave up wondows only because you encounter more problems than on a posix OS and there is little to no help online. – Syl May 08 '13 at 13:06
  • Would it be easier on Linux? Yes. Would it be more efficient? Not necessarily. It would be faster to setup your environment but once that is done, it is about the same. (At least, in my experience with Windows 7 and Ubuntu.) If you have the option to do it in Linux, do it! RubyMine is available for Linux. If you don't have the option, don't freak out. Windows setup is possible. It is just bloody difficult. – Charles Caldwell May 08 '13 at 13:25

2 Answers2

1

To answer your side note, ruby + windows is a painful, painful process imo. You would likely be better off installing VirtualBox and a modern Ubuntu virtual machine. It can be troublesome to get gems working under windows.

I use OSX at work, and am currently setting up an Ubuntu image from here : http://virtualboxes.org/images/ubuntu/ on my home laptop simply because I am sick and tired of trying to be productive on windows 7.

mcfinnigan
  • 11,442
  • 35
  • 28
  • 1
    Whereas it can be a pain to setup on Windows (a brutal, cruel, debilitating pain), once it is done, it is pretty smooth sailing. I code exclusively on Windows 7 and find myself quite productive. - Don't get me wrong, though, I would definitely code on a Mac if I could afford it. - – Charles Caldwell May 08 '13 at 13:22
  • Thanks to everyone for your help. After reading everyone's reply I think I'm going to bite the bullet and install a VM of linux. I can remember the same type of thing happening when I was working with Python in Windows 7x64 and so I went to Ubuntu which was a delight to code in Python. Seems like a good bet it'll be a great to code Ruby in as well. – Ariel Backer May 09 '13 at 00:05
0

Download a connector from here: http://dev.mysql.com/downloads/connector/c/6.0.html#downloads ZIP Archive and not installer, from its lib folder copy the libmysql.dll file and paste it into the Ruby200/bin directory. I think that should fix it.

Kazmin
  • 1,003
  • 1
  • 10
  • 26