Skip to content

Running Ruby Programs

Andy Piper edited this page Jan 24, 2021 · 5 revisions

Run apk add ruby ruby-dev build-base ruby-json. These packages are all necessary. If you're interested:

  • ruby is Ruby
  • ruby-dev is for Ruby headers that are required to build native extensions
  • build-base is also required to build native extensions
  • ruby-json is required to enable any gems that require JSON to work

Test to make sure Ruby is installed by typing ruby -v, you should see something along the lines of

ruby 2.5.7p206 (2019-10-1 revision 67816) [i586-linux-musl]

Congrats! You should now be able to install most Ruby gems. Edit below if there's errors.

FAQ

Can I install RVM?

Unfortunately, it doesn't look possible to install RVM at this time. I will update this if I find a way.

Ruby Related Errors

Gems won't install due to "Can't find ruby headers in [path]"

Solution: Make sure you installed ruby-dev from before. Remember, both ruby and ruby-dev are required.

Gems won't install due to "Can't find lsc++" etc

Solution: Make sure you installed build-base from before. This is required for native extensions to be built.

Gems won't run due to "ruby `require': cannot load such file -- json (LoadError)"

Solution: Alpine packages JSON separately. Make sure you install ruby-json

Gems that won't install

  • None known
Clone this wiki locally