Ruby1.9.2 small tip for installing gem install mysql2

Source: Internet
Author: User

Install MySQL gem for half a day before installation.

A small record:

 

First of all, this article is useful.Article:

Http://geryit.com/blog/2011/01/installing-mysql-with-rails-on-mac-os-x-snow-leopard/

 

My own environment is

Mac OS X 10.6

 

$ Rvm -- version
Rvm 1.6.5 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]

$ Mysql -- version
MySQL ver 14.14 distrib 5.1.57, for apple-darwin10.3.0 (i386) using Readline 5.1
$ Ruby-version
Ruby 1.9.2p180 (Revision 30909) [x86_64-darwin10.7.3]
$ Rails-V
Rails 3.0.7
$ Gem -- version
1.6.2
$ Uname-
Darwin bogon 10.7.3 Darwin kernel version 10.7.3: Sun Mar 6 13:37:56 PST 2011; root: xnu-1504.14.2 ~ 1/release_x86_64 x86_64

 

$ ENV archflags = "-arch x86_64" Gem install -- no-rdoc -- no-ri MySQL -- with-mysql-Config =/usr/local/MySQL/bin/mysql_config

 

$ ENV archflags = "-arch x86_64" Gem install -- no-rdoc -- no-ri mysql2 -- with-mysql-Config =/usr/local/MySQL/bin/mysql_config

Building native extensions. This cocould take a while...
Successfully installed mysql2-0.3.2
1 gem installed

 

The main problems we encountered earlier are: compilation is not successful, and gem is installed, but cannot be found in the GEM list.

The solution is mainly to match the gem and Ruby versions, replace the mysql version with 5.1, and install it in the rvm environment instead of using sudo.

 

Here is just a record, not detailed.

 

Lixinso [at] Gmail [Dot] com

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.