ROR debug环境搭建

Ruby和Rails的debug环境搭建竟然是如此的困难!

安装环境Mac OS 10.6, Ruby1.9.3, Rails 3.2.1, rvm

1. 利用rvm重新安装ruby及其源码

sudo rvm reinstall 1.9.3 --patch debug --force-autoconf

2. 安装ruby-debug19

gem install ruby-debug19 -- --with-ruby-include="$rvm_path/src/$(rvm tools identifier)/"

3. 安装linecache19-0.5.13.gem and ruby-debug-base19-0.11.26.gem。可以到http://rubyforge.org/frs/?group_id=8883去下载对应的版本

gem install linecache19-0.5.13.gem -- --with-ruby-include="$rvm_path/src/$(rvm tools identifier)/"

gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include="$rvm_path/src/$(rvm tools identifier)/"

4. 测试是否安装成功

$ irb
irb(main):001:0> require 'ruby-debug'
=> true

5. 到Rails工程目录下,修改GemFile,把下面的代码加到GemFile中。然后运行bundle install

gem ‘ruby-debug19′, :require => ‘ruby-debug’

6. 以debugger模式启动rails

rails server –debugger

如果那位大侠有更好的办法,请赐教。关于如何在windows安装还没知道解决方案,很多编译错误,google很久也没有解决。个人感觉Ruby和Rails的开发还是挺繁琐的,就环境搭建就费了很长时间,希望后面一切顺利。

参考资料
https://rvm.beginrescueend.com/support/troubleshooting
https://github.com/mark-moseley/ruby-debug/wiki/Installation%3A-command-line-version
http://dirk.net/2010/04/17/ruby-debug-with-ruby-19x-and-rails-3-on-rvm/
http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug

猜你喜欢

转载自evil850209.iteye.com/blog/1420568