Ask coding questions

← Back to all posts
trouble installing ruby gems
KyleSchulz (2)

I'm having trouble installing ruby gems. The example on the repl/ruby_gems page also appears to be broken. Any word on when this will be fixed?

Shad0w2k2 (0)

Hey everyone! So I found this was a simple 2 step process. If this is what's intended maybe the help docks may need a bit-o-dusting off.
Step 1. In your packages install the gem you want to use. In my case it was bcrypt.
Step 2. In your .replit file for your run use "run="bundle exec ruby YourRubyFile.rb"

Thats all I had to do. Just use the standard require 'bcrypt' at the top of your script and go! I hope this helps.

Working Example:

markshaw4 (0)

I'm having same issue, strangely it works if it's a Sinatra project, just not a Ruby project.

PattanAhmed (1397)

@KyleSchulz Hi,
You can install a gem using gem install [gem]
Then you can local-search through all your installed gems.

Hope this helps
Please mark my answer if this helps

JosephSanthosh (1196)

Gem search -r rails will return a list of Rails-related gems. With the --local ( -l ) option, you would perform a local search through your installed gems. To install a gem, use gem install [gem] .

If this helped or answered your question please mark this as correct!


No, but if you can find the source code for ruby gems you can add a file called ruby.h and then at the top of your code import ruby.h if you can import things in ruby.