error when installing mysql ruby gem on OSX 10.6.3 - mysql

So I am getting the same issue as mentioned here -
gem install mysql failure in Snow Leopard
But I haven't been able to get it fixed using the answers on this link.
Here's a brief history -
I had MAMP on my machine,
but now I downloaded the latest MySQL from mysql.com and installed version 5.1.46
this new version runs fine and client "mysql" is able to connect
and I also have XCode v3.2.1, since someone mentioned that it can cause issues.
Here's the error -
**Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb --with-mysql-config=/usr/local/mysql/bin/mysql_config
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out**

"can't find header files for ruby" usually means that the system can't locate the header files for Ruby. This happened to me when I upgraded to 10.6 from 10.5. Download the latest XCode from Apple's site and reinstall it. Make sure that you check the box for "UNIX Development" during the install. The header files for Ruby are not in the main package.
Have you installed other versions of Ruby or are you using the standard 1.8.7 that comes with OS X? You can check your version of ruby by typing ruby -v at a terminal prompt.

Related

Having issues attaching ruby to mysql using the mysql2 gem

Rails version 6.0.4.6
Ruby Version 2.7.5p203
mySql version 8
OS Window 10
I am having issues getting the mysql2 gem to work. The latest error I have is not being able to locate "mysql2 x64-mingw32" file. I installed the gem using this command:
gem install mysql2 --platform=ruby -- --with-mysql-dir="C:\Program Files\MySQL\Connector C++ 8.0"
--with_mysql-lib="C:\Program Files\MySQL\Connector C++ 8.0\lib64" --with_mysql_include="C:\Program Files\MySQL\Connector C++ 8.0\include"
It appears to have been installed correctly but still will not work. I have run bundle install. I have also tried deleting the gem.lock file and the running bundle install.
If anyone has had success in getting ruby to work with MySQL on a Windows machine, please let me know how you did it.
After many trails, it appears the Ruby just doesn't play well with Windows OS. While I expect that some do use Ruby on Windows, it appears the support is lacking, and the community is small.
I installed a Linux terminal on my machine and had much better luck.
Just posting to keep other from pulling their hair out.

Rails - Error installing Gem

Im newbie starting to learn ruby/rails. While i was trying to setup WeBRICK to run, an error related to the libmysql.dll appeared, so ive downloaded an dll from an older version of mysql and tried again, but the error kept. Then i read that the problem was that my computer is 64bit and the gem mysql2 installed apparently is 32bit, that way i uninstalled that gem and tried to do the following workaround:
1) download mysql connector 32 bits
2) gem install mysql --platform=ruby -- --with-mysql-dir=C:/mysql-connector-c-noinstall-6.0.2-win32
the problem now is that im getting the following error:
ERROR: While executing gem ... (Errno::EEXIST)
File exists - C:
So, now i cant even install the mysql2 gem
Can you guys help me please?
It's not recommended to run ruby on rails on windows. mac or linux will be better.
if you can't change your OS. you can try this:
http://eric.cloud-mes.com/2012/04/1/install-Ruby-1.9.3-and-Rails-3.2.3-on-Windows-7.html

Finally installed MySQL for Rails in Windows 64 bit, and now

Environment:
Windows 7 64bit (Home Premium)
Ruby 1.9.2 p290 (2011-07-09) [i386-mingw32]
Rails 3.0.10
MySQL 5.5
Ruby, despite my having successfully installed the mysql2 rubygem thinks that the gem is missing when I invoke a rails command that requires it.
After having spent the evening getting the mysql rubygem installed on Windows 64 bit, I decided to (finally) get cracking on linking mysql to a local rails server. This is how I was trying to do it...
(Fairly) Exact transcript from cmd.exe
C:\rails\cookbook>gem install mysql --platform=ruby -- --with-mysql-include=c:\mysql\include --with-mysql-lib=c:\mysql\lib
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed mysql-2.8.1
1 gem installed
Installing ri documentation for mysql-2.8.1...
Installing RDoc documentation for mysql-2.8.1...
(I thought this was successful mysql install, should I test it somehow?)
C:\>gem install mysql2 --platform=ruby -- --with-mysql-include=c:\mysql\include --with-mysql-lib=c:\mysql\lib
Fetching: mysql2-0.3.7.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed mysql2-0.3.7
1 gem installed
Installing ri documentation for mysql2-0.3.7...
Enclosing class/module 'mMysql2' for class Client not known
Installing RDoc documentation for mysql2-0.3.7...
Enclosing class/module 'mMysql2' for class Client not known
(Same as above - I thought this was successful mysql install)
C:\rails>rails new cookbook -d mysql
(successfully creates directories for project in c:\rails\cookbook)
C:\rails\cookbook>rails server
?[31mCould not find gem 'mysql2 (~> 0.2.11)' in any of the gem sources listed in your Gemfile.?[0m
?[33mRun `bundle install` to install missing gems.?[0m
Notes:
I noticed it wants rubygem mysql2-0.2.11, I have 0.3.7. I tried installing 0.2.11 specifically by the method I used to install the two gems above. No dice, it couldn't find a gem by the name mysql2-0.2.11 in 'any repository'
I'm stumped, any thoughts fellas (and gals)?
I believe your MySQL installation is a 64bits (like Windows), correct?
Ruby is 32bits, so you cannot link 32bits against 64bits.
I've posted a article covering the installation steps on my blog:
http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/
These steps use MySQL Connector/C to workaround the 32bits versus 64bits issues.
Both mysql or mysql2 gem should work with this.
Have you included mysql2 in your Gemfile and subsequently executed bundle install ?
## my sql installation (on 64 bit architecture)
download connector (download zip file and extract it to c drive)
http://dev.mysql.com/downloads/connector/c/
download mysql
http://dev.mysql.com/downloads/installer/5.6.html
command to install mysql with connector
C:\Sites\rails_project\resume>gem install mysql --platform=ruby -- --with-mysql-
dir=C:/mysql-connector-c-6.1.0-win32
After this copy libmysql.dll from connector folder and paste it to ruby>bin folder

How to install gem MySQL on Mac OS 10.6.6

Ruby already installed on Mac. So i just installed rails.
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
rails 2.3.11
gem 1.3.5
When i trying : gem install mysql i get this error:
89-235-235-64:~ vitali$ gem install mysql
WARNING: Installing to ~/.gem since /Library/Ruby/Gems/1.8 and
/usr/bin aren't both writable.
WARNING: You don't have /Users/vitali/.gem/ruby/1.8/bin in your PATH,
gem executables will not run.
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Gem files will remain installed in /Users/vitali/.gem/ruby/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /Users/vitali/.gem/ruby/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
89-235-235-64:~ vitali$
Dont understand what to do. gem install mysql installing without MySQl itself or I should download and install MySQL as prorgamm? If yes, from what resource, what version, how to instal? Please help me, im newbie on mac. Big thanks!
You're almost certainly going to need MySQL installed to have the MySQL gem installed (even better is the mysql2 gem, which Rails also works with - just use mysql2 instead of mysql in your database.yml file).
I find the best way to get MySQL on my Mac whenever I format it (which, admittedly, is rarely) is to use Homebrew. So, if you don't have Homebrew installed, I'd start with that... and once that's done, it should be a matter of running sudo brew install mysql, and running the instructions it provides after the installation is done.

Installing datamapper mysql dm-mysql-adapter on redhat

I'm trying to move a small Sinatra app I have going on an Ubuntu box to a redhat box.
While installing gems, I get a "Can't build native extension" error while trying to install the gem dm-mysql-adapter.
I have mysql-devel installed, which I believe is the required library, but it doesn't seem to work.
All the info I can find online is for Ubuntu and says installing libmysqlclient-dev (which doesn't exist for Redhat; again, I believe mysql-devel is the appropriate package).
Any advice for someone using redhat?
you have the correct package "mysql-devel-5.1.48-1" but the gem installs fine on my centos5 box without the package installed, you could try the ruby-mysql gem instead.
[11:13:01][root#HOST:~]# gem search mysql
*** LOCAL GEMS ***
[11:13:03][root#HOST:~]# rpm -qa | grep -i mysql
perl-DBD-MySQL-3.0007-2.el5
mysql-5.0.77-4.el5_5.4
[11:13:11][root#HOST:~]# gem install mysql
Building native extensions. This could take a while...
Successfully installed mysql-2.8.1
1 gem installed
Installing ri documentation for mysql-2.8.1...
...
[11:13:22][root#HOST:~]#