/openbsd

Install Ruby on Rails in OpenBSD

Install Ruby on Rails in OpenBSD

Here you can see instruction.

  1. Install Ruby
 $ pkg_add ruby
 #I choose 2.3.1
  1. Install Gems
$ pkg_add ruby-gems

For running Gem you need type in terminal $ gem23

Better to create link with this command:

$ ln -sf /usr/local/bin/gem23 /usr/local/bin/gem

  1. Add ~/.gem/ruby/2.3/bin to PATH
PATH="~/.gem/ruby/2.3/bin:"$PATH

For running Ruby you need type in terminal $ ruby23

Better to create link with this command:

$ ln -sf /usr/local/bin/ruby23 /usr/local/bin/ruby

  1. Install Bundle
$ gem install --user-install bundler
  1. Install Nokogiri (or run into problems installing rails)
$ pkg_add ruby-nokogiri
  1. Install Rails
$ gem install --user-install rails

For running Rails you need type in terminal $ rails23

Better to create link with this command:

$ ln -sf /usr/local/bin/rails23 /usr/local/bin/rails

  1. Create project with next command:

rails new <projectname>

will throw an issue with nokogiri so...

$ gem install --user-install nokogiri

  1. Install node.js
$ pkg_add node

  1. Add node to the Gemfile
gem 'node'
  1. Run bundle install to install your gems!
$ bundle install --path=~/.gem
  1. Profit!!

Running app with rails s

alt text

The gem install --user-install bundler puts the bundler local to the user. Adding the directory to the path allows for bundler to be used where it was installed. If you want to go a step further you can soft link /usr/local/bin/ruby23 to /usr/local/bin/ruby and do something similar with /usr/local/bin/rails23 and ~/.gem/ruby/2.4/bin/bundle(r)23. I just run the commands as they are right now.

I also ran into an issue with the rubyracer, for some reason bundle didn't find python or python2 (or something like that). Instead I used the node gem, and installed nodejs on my server.

Original version of article: Click this link!