开发者

installing rails

I'm trying to install rails and its giving me a headache, I can't seem to get it working. I'm using osx 10.5 and I used macports to get rub,rails and ruby gems installed in opt/local/bin but mysql is getting frustrating, I have it working in a mamp directory, I also tried installing it via the dmg, which works but the profile won't work everytime I try to load it it开发者_运维知识库 says "Could not load mysql preference pane" and if I try in terminal type which mysql I get: /usr/local/mysql/bin/mysql but if I try to check the version I get :

mysql -version
dyld: unknown required load command 0x80000022
Trace/BPT trap

I'm trying to launch webrick inside a rails app i've created but when I run "rails server" I get the error:

Could not find gem 'mysql2 (>= 0)' in any of the gem sources listed in your Gemfile.

I have no idea whats going on

Isn't there an easy way to install rails like MAMP?

UPDATE: ok I got mysql installed, apprently there is a bug with the latest version causing a problem with the preference pane. mysql is installed in

/usr/local/mysql/bin/mysql

2 questions I have about this. Is this the right path should it not be in /usr/local/mysql ? and the second is how would I link this to my ruby gem? is this right:

sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql

or

sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql/bin/mysql


I suggest you use HomeBrew to install mysql or ruby instead of MacPorts.

Could not find gem 'mysql2 (>= 0)' in any of the gem sources listed in your Gemfile.

This error is caused because rails requires the mysql2 gem to connect to mysql. All you have to do in include

gem mysql2

to the gemfile in the root directory of the rails app and do a bundle install

If you just trying out rails then you might as well use the default sqlite3 database forget about mysql.


The installation path is correct.

Installing the mysql gem is slightly more complicated than necessary since the installation automatically tries generating both 32bit and 64bit versions.

Assuming you have installed the 64 bit binary package, try the following (from the bash command line):

ARCHFLAGS="-arch x86_64" gem install mysql2 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

However, it is recommended that you do not mess with the OSX ruby installation and use rvm (The Ruby Version Manager) to create a customized ruby environment. You can find a good tutorial for Rails and RVM here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜