安装导轨
我正在尝试安装导轨,这让我很头疼,我似乎无法让它工作。我正在使用 osx 10.5,我使用 macports 将 rub、rails 和 ruby gems 安装在 opt/local/bin 中,但是 mysql 变得令人沮丧,我让它在 mamp 目录中工作,我还尝试通过 dmg 安装它,可以工作,但每次我尝试加载它时,配置文件都无法工作,它会显示“无法加载 mysql 首选项窗格”,如果我尝试在终端输入哪个 mysql,我会得到: /usr/local/mysql/bin/mysql 但如果我尝试检查我得到的版本:
mysql -version
dyld: unknown required load command 0x80000022
Trace/BPT trap
我正在尝试在我创建的rails应用程序中启动webrick,但是当我运行“rails server”时,我收到错误:
Could not find gem 'mysql2 (>= 0)' in any of the gem sources listed in your Gemfile.
我不知道发生了什么
没有像MAMP这样简单的方法来安装rails ?
更新: 好的,我安装了 mysql,显然最新版本有一个错误,导致首选项窗格出现问题。 mysql 安装在
/usr/local/mysql/bin/mysql
我对此有两个问题中。这是正确的路径吗?它不应该在 /usr/local/mysql 中吗? 第二个问题是我如何将其链接到我的红宝石宝石?这是对的吗:
sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
或者
sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql/bin/mysql
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我建议你使用 HomeBrew 安装 mysql 或 ruby 而不是 MacPorts。
这个错误是因为rails需要mysql2 gem来连接mysql而导致的。您所要做的就是包含
到 Rails 应用程序根目录中的 Gemfile 并执行捆绑安装
如果您只是尝试 Rails 那么您不妨使用默认的 sqlite3 数据库忘记了 mysql。
I suggest you use HomeBrew to install mysql or ruby instead of MacPorts.
This error is caused because rails requires the mysql2 gem to connect to mysql. All you have to do in include
to the
gemfile
in the root directory of the rails app and do abundle install
If you just trying out rails then you might as well use the default sqlite3 database forget about mysql.
安装路径正确。
安装 mysql gem 比必要的稍微复杂一些,因为安装会自动尝试生成 32 位和 64 位版本。
假设您已经安装了 64 位二进制包,请尝试以下操作(从 bash 命令行):
但是,建议您不要搞乱 OSX ruby 安装并使用
rvm< /code> (Ruby 版本管理器)创建自定义的 Ruby 环境。您可以在此处找到有关 Rails 和 RVM 的优秀教程。
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):
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.