I installer ruby-debugger but even after that , when I try to start the rails server with "--debugger" option I get a console error saying that ruby-debugger is not installed see the logs below :-
:~/work_space/rails_apps/Bidding_sys_remaining$ sudo gem install ruby-debug <<<<<<<
Building native extensions. This could take a while...
Building native extensions. This could take a while...
Successfully installed columnize-0.3.2
Successfully installed linecache-0.43
Successfully installed ruby-debug-base-0.10.4
Successfully installed ruby-debug-0.10.4
4 gems installed
Installing ri documentation for columnize-0.3.2...
Installing ri documentation for linecache-0.43...
Installing ri documentation for ruby-debug-base-0.10.4...
Installing ri documentation for ruby-debug-0.10.4...
Installing RDoc documentation for columnize-0.3.2...
Installing RDoc documentation for linecache-0.43...
Installing RDoc documentation for ruby-debug-base-0.10.4...
Installing RDoc documentation for ruby-debug-0.10.4...
:~/work_space/rails_apps/Bidding_sys_remaining$
:~/work_space/rails_apps/Bidding_sys_remaining$ rails server --debugger
=> Booting WEBrick
=> Rails 3.0.1 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
Exiting
This is the first time I'm trying to use the rails debugger.
Also any suggestions for links, to get help for getting started with rails debugger any guides for newbies ??
Make sure you include the gem in the Gemfile
gem 'ruby-debug' # for ruby 1.8.7+
gem 'ruby-debug19' # for ruby 1.9.2+
and then run bundle install
Update:
You can also add this to your Gemfile and it will take care of both ruby versions.
gem 'ruby-debug19', :require => 'ruby-debug', :platforms => :mri_19
gem 'ruby-debug', :platforms => :mri_18
Just to hop on to what George said, since the Gemfile supports it, you might want to put it in a group, since you likely don't want ruby-debug in production.
group :development do
gem 'ruby-debug19' # or ruby-debug for 1.8.7
end
Related
I just updated to Ruby 1.9.3p0 and Rails 3.1.1. Now when I try to launch the server, it complains that I should install ruby-debug, even though it's already installed.
% rails server --environment=development --debug
=> Booting WEBrick
=> Rails 3.1.0 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
Exiting
In my Gemfile I have
# see: http://stackoverflow.com/questions/1083451/debugging-in-ruby-1-9
gem 'ruby-debug-base19', "0.11.24"
gem 'ruby-debug19', "0.11.6"
Is it possible to run debug with the latest version of Ruby?
Update (April 28, 2012)
Try the new debugger gem as a replacement for ruby-debug.
(credit to #ryanb)
Update (March 2, 2012)
Installation of linecache19 and ruby-debug-base19 can be easily done with:
bash < <(curl -L https://raw.github.com/gist/1333785)
(credit to #fredostarr)
Original answer
Have you looked at ruby-debug19 on ruby-1.9.3-preview1?
Here's a temporary solution:
http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug
Excerpt from the site:
First download linecache19-0.5.13.gem and
ruby-debug-base19-0.11.26.gem from
http://rubyforge.org/frs/?group_id=8883, then …
$ gem install linecache19-0.5.13.gem
Building native extensions. This could take a while...
Successfully installed linecache19-0.5.13
1 gem installed
$ gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=/Users/santiago/.rbenv/source/ruby-1.9.3-p0
Building native extensions. This could take a while...
Successfully installed ruby-debug-base19-0.11.26
1 gem installed
$ irb
irb(main):001:0> require 'ruby-debug'
=> true
Installation of linecache19 and ruby-debug-base19 can be easily done with:
bash < <(curl -L https://raw.github.com/gist/1333785)
Someone else posted in a comment to try Pry, which is what I did. This is what's necessary for Rails:
# Gemfile
gem 'pry-rails'
# In your Rails Project where you want a 'debugger'
puts 'i want to insert some code between this'
binding.pry
puts 'and this'
Immediately after installing I notice my .irbrc doesn't load, so I don't get pretty console output. I also added this to my '~/.pryrc'
# setting up pry to have irb helpers like reload!
if defined?(Rails) && Rails.env
extend Rails::ConsoleMethods
end
Pry has some nice features that I've wanted to check out, and I may yet return to ruby-debug once there's a simple way to integrate it into a Rails project for Ruby 1.9.3. I can run the curl command from the other answers, but this is something I'll have to point my teammates to for our Rails project, so it doesn't scale well IMO.
Maybe not the definitive answer to this question, but I was lead here by a chain of closed duplicates.
For me the problem was that I run a project in both ruby 1.8 and ruby 1.9, and my Gemfile needed this change:
gem 'debugger', :require => 'ruby-debug', :platforms => :mri_19
gem 'ruby-debug', :platforms => :mri_18
Now it works for both rubies.
For more info see here: http://gembundler.com/man/gemfile.5.html#PLATFORMS-platforms-
For Windows Users:
First Download :linecache19-0.5.13.gem and ruby-debug-base19-0.11.26.gem
From : http://rubyforge.org/frs/?group_id=8883&release_id=46303
Assumption: Ruby is in c:\Ruby1.93
put the gem files downloaded to c:\temp
(linecache19-0.5.13.gem and ruby-debug-base19-0.11.26.gem)
then execute from command line:
gem install c:\temp\linecache19-0.5.13.gem
gem install c:\temp\ruby-debug-base19-0.11.26.gem -- --with-ruby-include=C:\Ruby1.93\include\ruby-1.9.1\ruby-1.9.3-p0
BTW, if you use the newest patch for ruby1.9.3 (falcon, https://gist.github.com/1688857), use following commands
wget http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
wget http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
gem install linecache19-0.5.13.gem
## with rvm:
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=$HOME/.rvm/src/ruby-1.9.3-p0-falcon
## with rbenv (this is a guess):
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=$HOME/.rbenv/source/ruby-1.9.3-p0-falcon
See my answer here :
Ruby-debug not working - Stack Overflow
It's about getting Ruby debugging to work with the following setup
Mac OS X Lion 10.7.2
Aptana Studio 3 (Build 3.0.8.201201201658)
Using rvm, in my project working directory I have a .rvmrc stating:
rvm use ruby-1.9.3-p0#mygemset
Basically, I had to use :
linecache19 (0.5.13)
ruby-debug-base19x (0.11.30.pre10)
ruby-debug-ide (0.4.16)
Note that I'm not using ruby-debug-base19 but ruby-debug-base19x
I hope this helps!
-- Freddy
Also you need to check if the gem 'ruby_source_code' is already installed.
Check: http://bugs.ruby-lang.org/issues/1857#note-8
If you don't have rvm and assuming you ruby installation is in /usr/local/ruby-1.9.3-po your can use this command:
curl -L https://raw.github.com/gist/1533750 | sudo /bin/bash
I just installed a fresh version of Ruby 1.9.2 via RVM on Mac OSX 10.7. I've activated 1.9.2 and my system seems to recognize ruby/gem/rails:
which ruby => /Users/me/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
which gem => /Users/me/.rvm/rubies/ruby-1.9.2-p290/bin/gem
which rails => /Users/me/.rvm/gems/ruby-1.9.2-p290/bin/rails
I've bundle install'ed my existing rails app. No errors upon gem installation. Everything comes up on 'gem list'. However, when I try to bootstrap the app with 'rails server', I get the following error:
/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require': no such file to load -- sass/rails/version (LoadError)
Full trace: https://gist.github.com/1215816
Again, sass and rails are installed:
gem list | grep sass => sass (3.1.7)
gem list | grep rails => rails (3.1.0)
I'm not sure what the 'version' part is about. Any ideas?
Turns out I didn't have the sass-rails gem installed. That must have been what the error was trying to communicate. Working now!
I have standard ruby-head and Rails 3.1rc4.
I installed ruby-debug with following instructions from http://dirk.net/2010/04/17/ruby-debug-with-ruby-19x-and-rails-3-on-rvm/
But when i run rails s --debugger it will throw this strange error
/Users/schovi/.rvm/gems/ruby-head/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237:in `require': dlopen(/Users/schovi/.rvm/gems/ruby-head/gems/linecache19-0.5.12/lib/trace_nums19.bundle, 9): Symbol not found: _ruby_current_thread (LoadError)
Referenced from: /Users/schovi/.rvm/gems/ruby-head/gems/linecache19-0.5.12/lib/trace_nums19.bundle
Expected in: flat namespace
in /Users/schovi/.rvm/gems/ruby-head/gems/linecache19-0.5.12/lib/trace_nums19.bundle - /Users/schovi/.rvm/gems/ruby-head/gems/linecache19-0.5.12/lib/trace_nums19.bundle
from /Users/schovi/.rvm/gems/ruby-head/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237:in `block in require'
from /Users/schovi/.rvm/gems/ruby-head/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223:in `block in load_dependency'
Any idea?
Thanks, David
UPDATE:
Looks like you only need to put this in your gemfile:
gem "debugger"
and now works.
Old article follows
====================================
Jerome is correct, but lacking in the details. Here is the blow by blow, taken from this https://gist.github.com/1331533, in particular thanks to andrewroth's post. I've tested this as of the time of this post. One hopes that the changes will be deployed somewhere standard soon.
Installing ruby debugger on ruby 1.9.3-p125:
export PATCH_LEVEL=`ruby -e 'puts RUBY_PATCHLEVEL'`
export RVM_SRC=$HOME/.rvm/rubies/ruby-1.9.3-p$PATCH_LEVEL/include/ruby-1.9.1
gem install archive-tar-minitar
gem install ruby_core_source -- --with-ruby-include=/$RVM_SRC
export RVM_SRC=$HOME/.rvm/rubies/ruby-1.9.3-p$PATCH_LEVEL/include/ruby-1.9.1/ruby-1.9.3-p$PATCH_LEVEL
wget http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
wget http://rubyforge.org/frs/download.php/63094/ruby-debug19-0.11.6.gem
wget http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
gem install linecache19-0.5.13.gem -- --with-ruby-include=/$RVM_SRC
# if that step failed, and you are running OSX Lion, then following this post can help you:
# http://stackoverflow.com/questions/8032824/cant-install-ruby-under-lion-with-rvm-gcc-issues
# this happens if you recently installed xcode from the app store.
# bizarrely, for me I had to do this: ln -s /usr/bin/gcc /usr/bin/gcc-4.2
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=/$RVM_SRC
Then edit Gemfile:
gem 'linecache19', '0.5.13', :path => "~/.rvm/gems/ruby-1.9.3-p#{RUBY_PATCHLEVEL}/gems/linecache19-0.5.13/"
gem 'ruby-debug-base19', '0.11.26', :path => "~/.rvm/gems/ruby-1.9.3-p#{RUBY_PATCHLEVEL}/gems/ruby-debug-base19-0.11.26/"
gem 'ruby-debug19', :require => 'ruby-debug'
Then install:
bundle install
I used the gem 'debugger' which is a fork of ruby-debug(19) that works on 1.9.2 and 1.9.3 and installs easily for rvm/rbenv rubies.
It makes the error disappear !
It looks like this is a known bug in ruby-debug-base, for the moment. I have added my comment to the issue on the bug tracker. Plase consider adding your notes as well:
http://rubyforge.org/tracker/index.php?func=detail&aid=29222&group_id=8883&atid=34290
In the meantime, ruby 1.9 has a built-in debugger; its just very slow. Manually add this require line to your code:
require 'debug'
Also, the debugger breaks on all StandardError exceptions by default, so do this when it first starts up:
catch off
If you are running Ruby 1.9.3x, to fix it go to ruby-debug on rubyforge, download and install ruby-debug-base 0.11.26 and linecache19 0.5.13. Modify your Gemfile to use these files, then run
bundle update ruby-debug-base19
Debugger should work now.
Thanks
Jerome
This was fixed upgrading to the latest gems of all debug
Using ruby 1.9.3, I was able to get this to work by adding the gem 'ruby-debug-base19x' (note the 'x' at the end of the name) in addition to 'ruby-debug19'.
My system is rvm 1.18.10 and ruby 1.9.3p392 on Mac OSX 10.8.5. I first installed gem 'ruby-debug19', but for the well-known reason, the debugger did not work.
I then ran
local$ gem install 'debugger'
as suggested by many other posts. The gem was installed successfully with the following outputs:
local$ gem install debugger
Fetching: debugger-ruby_core_source-1.2.3.gem (100%)
Fetching: debugger-linecache-1.2.0.gem (100%)
Fetching: debugger-1.6.2.gem (100%)
Building native extensions. This could take a while...
Successfully installed debugger-ruby_core_source-1.2.3
Successfully installed debugger-linecache-1.2.0
Successfully installed debugger-1.6.2
3 gems installed
Installing ri documentation for debugger-ruby_core_source-1.2.3...
Installing ri documentation for debugger-linecache-1.2.0...
Installing ri documentation for debugger-1.6.2...
Installing RDoc documentation for debugger-ruby_core_source-1.2.3...
Installing RDoc documentation for debugger-linecache-1.2.0...
Installing RDoc documentation for debugger-1.6.2...
local$ irb
1.9.3-p392 :002 > require 'debugger'
=> true
I then ran
local$ rails server --debug
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:
in`require': dlopen(/usr/local/rvm/gems/ruby-1.9.3-p392/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle,
9): Symbol not found: _ruby_current_thread (LoadError)
Referenced from: /usr/local/rvm/gems/ruby-1.9.3-p392/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle
Expected in: flat namespace
in /usr/local/rvm/gems/ruby-1.9.3-p392/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle - /usr/local/rvm/gems/ruby-1.9.3-p392/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle
......
I resolved this error by commenting out the line "gem 'ruby-debug19'" and adding a new line "gem 'debugger'" in the Gemfile, and then ran
local$ bundle update
After that, everything worked fine.
local$ rails server --debug
=> Booting WEBrick
=> Rails 3.2.14 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
=> Debugger enabled
[2013-10-15 12:50:21] INFO WEBrick 1.3.1
[2013-10-15 12:50:21] INFO ruby 1.9.3 (2013-02-22) [x86_64-darwin10.8.0]
[2013-10-15 12:50:21] INFO WEBrick::HTTPServer#start: pid=7206 port=3000
Please see below:
$ sudo gem install ruby-debug
Successfully installed ruby-debug-0.10.4
1 gem installed
Installing ri documentation for ruby-debug-0.10.4...
Installing RDoc documentation for ruby-debug-0.10.4...
That all looks great, then when I go to fire up the server, it starts up and then exists:
$ rails server --debugger
=> Booting WEBrick
=> Rails 3.0.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Silencing Postgres
You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
Exiting
Anyone seen this before?
Thanks
You probably need to put it in the Gemfile, gem 'ruby-debug' and then run bundle install on it. Try that
I am trying to get rmagick to work with rails 3 on windows.
I have manually installed the pre-compiled win32 version of rmagick and have this in my Gemfile:
gem "rmagick", "2.12.0"
But when I do bundle install, it tries to fetch it from the source (http://rubygems.org) instead of identifying that it is already installed on the system.
Here's what gem list rmagick shows on my system:
* LOCAL GEMS *
rmagick (2.12.0 mswin32)
My ruby version is ruby 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32]
Can anyone help me out on how to get this to work on windows?
gem 'rmagick', "2.12.0", :platforms => :mswin, :require => false
However there's a bug in bundler and you will not be able to
require 'rmagick'
in your controllers.
try to run:
set proxy=http://server:port
bundle install
Try to run 'bundle install --local'.