A Note Before Beginning

If you made it here after trying to install "fast debugging" or some other feature... the headache that awaits you below is NOT necessary. ONLY follow the below instructions if you REALLY, REALLY want to let NetBeans manage your gems. If you only want to use fast debugging or some other absent gem, save yourself the trouble, drop to a command line, and type "sudo gem install ruby-debug-ide" (in the case of fast debugging). If you don't have sudo access, you'll have to su to root. After installing the gem(s) you need, restart NetBeans and you should be good to go.
Now...that said...
You can install Ruby functionality called "gems" using the Ruby Gems Manager from the Tools menu. The feature is described in a bit more detail in the projects document.

Troubleshooting

You might encounter some problems during the Ruby Gems Manager usage:
  • the Ruby Gems Manager needs to write files into your Ruby installation directory, which is often a privileged directory.
  • on some systems, Ruby does not include RubyGems by default.
Thus, some things can go wrong, and this document attempts to describe some solutions.
RubyGems needs to be installed
Your Ruby installation needs to have the gem command available. If you are using the bundled JRuby installation, that is already the case.
TBD - describe how or put a link to appropriate document.
Permissions problems
You also need to have permission to run the gem command to install, upgrade or uninstall gems. If you have switched to for example /usr/bin/ruby on your Linux box, the gem installation directory is probably not writable without root privileges. NetBeans will inform you of this problem, linking to this wiki page, with the following dialog:

permission_error.png

There are several ways to solve this:
  • Install your own private copy of Ruby somewhere else, and use that instead. Remember not to run the make installation step as root. See below section "Installing your own private copy of Ruby on Ubuntu".
  • Change the write permissions on the gem directory to permissions allowing you to write files there.
Here's an example how joe changes the permission of repository in /var/lib/gems/ (default on Ubuntu BTW), which had root-owned files, to allow him to to run gem without root access:
joe@rubycomp:~$ cd /var/lib/gems/
joe@rubycomp:/var/lib/gems$ sudo chown -fR joe .
[sudo] password for joe:
  • Run NetBeans as root. I don't recommend this approach.
  • Create a private repository for your gems. This will save you the trouble of installing your private copy of Ruby, while keeping your system's security intact.
    TBD - this might be done from within the IDE easily in 6.1, describe how.
Problem with installing Gems which use native extensions
Some RubyGems use native extension, i.e. they are (partially) written in C and thus need to be compiled during installation. If you encounter kind of failed to build native extensions problems during Gem installation, be sure:
  • that you are not using JRuby interpreter at the moment which cannot build native C extension (there are often counterparts extension written in Java, you might try to find it)
  • you have GCC installed on your Unix-like system (Linux, Mac OS X, ...) so the native compilation is possible.
    • on Mac OS X be sure you have installed Developer Tools. They're not installed by default but they're on the install CD's you get with Leopard.
    • on Ubuntu (7.10 in the time of writing this) following packages need to be installed for compilation. Run:
sudo apt-get install build-essential autoconf
In the case you are using Ruby package from Ubuntu repository, be sure you also install ruby<version>-dev package, like ruby1.8-dev or ruby1.9-dev. Otherwise you can't compile any native extensions. E.g.
sudo apt-get install ruby1.8-dev
Please update this Wiki page section for your OS which is not mentioned here yet.
Installing your own private copy of Ruby
Take a look at this page to see how to install own Ruby on some systems.
Installing FastDebugger on Debian (testing).
Not sure it's the best solution, but you can setup fast debugger in a few simple steps without creating your own gems repository.
Install ruby-debug-ide:
spectator:/$ sudo gem install ruby-debug-ide
Make symbolic link:
spectator:/$ sudo ln -s /var/lib/gems /usr/lib/ruby/gems
That's all! Your NetBeans will detect installed fast debugger and will use it by default.