MySQL gem error after upgrading to Snow Leopard

Just upgraded to Snow Leopard. After much turmoil, I managed to start MySQL and start it.

Now I'm trying to get Rails environments to work. For the project, I use Rails 3.0.3 and Ruby 1.8.7

I installed the MySQL2 gem using the following command:

sudo gem install mysql2 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

When I start the rails server, I get the following error:

/Users/lee/.rvm/gems/ruby-1.8.7-head/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle: dlopen(/Users/lee/.rvm/gems/ruby-1.8.7-head/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle, 9): no suitable image found.  Did find: (LoadError)
/Users/lee/.rvm/gems/ruby-1.8.7-head/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle: mach-o, but wrong architecture - /Users/lee/.rvm/gems/ruby-1.8.7-head/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle
from /Users/lee/.rvm/gems/ruby-1.8.7-head/gems/mysql2-0.2.6/lib/mysql2.rb:7

Has anyone experienced a similar problem and know how to fix it? I am more a designer than a developer, so this will not be my strongest area. Rate any pointers.

+3
source share
4 answers
+3

- Snow Leopard. , 32- , SL 64- . -, , 64- MySQL, .

, : gem uninstall mysql2

, , Rails (32-) , .

, mysql

export ARCHFLAGS="-arch i386 -arch x86_64"

sudo gem mysql2

0

, :

Ruby RVM, . Snow Leopard i386 32- . x86 64bit. , RVM do rvm uninstall Ruby 1.8.7, rvm install . , , rvm list:

rvm list

rvm rubies

   ruby-1.8.7-p330 [ x86_64 ]
=> ruby-1.9.2-p136 [ x86_64 ]

Ruby, 1.8.7 1.9+, x86_64 Snow Leopard.

gem pristine, . , x86_64.

, RVM . rev, , - v1.1.13, , , rvm get head, .

, , : gem env rvm info.

0

, " , " rails rails.

file .dylib gem, , x86_64, , . , Ruby, . /usr/bin/ruby ​​ i386. , , xcode osx 10.7 64- .

RVM, ruby ​​( 1.8.7). readline ( homebrew,: brew install readline) rvm rvm install 1.8.7 --with-readline-dir=/usr/local/Cellar/readline/6.2.1/.

ruby ​​(rvm use 1.8.7) ( RVM - gem_path ). gem install rake, gem install bundler, bundle install .

, , ruby ​​ , ruby ​​/rails.

: http://www.markhneedham.com/blog/2010/07/08/installing-ruby-1-9-2-with-rvm-on-snow-leopard/

0

Source: https://habr.com/ru/post/1782591/


All Articles