Ruby 1.8.6-111 on OpenBSD 4.2 (and Ruby-On-Rails)

Posted by face on November 04, 2007

Update: December 31, 2007: Official OpenBSD 1.8.6 patch level 111 ports have been checked into CVS. This post and the associated binaries have been updated to use the official port. My unofficial port has been discarded.

This article describes building a ruby port from source. If you want the binaries produced by this article, I have released them via this Rubyforge project.

If your ports tree is not already prepped, please begin by prepping your ports tree.

There is a message that you may run out of memory without modifying login.conf. My login.conf was already modified. My login is a member of the staff group:

We will be using the official OpenBSD port from CVS.

We will start by installing the prerequisites as binaries because if you have a fast internet connection, it is faster than building the ports from src:
sudo su
setenv PKG_PATH "" 
# or export PKG_PATH="" 
pkg_add libiconv gdbm tk-8.4.7p1

Now lets update the ruby port from CVS HEAD and build it. I did this on December 31, 2007 and the snapshot of the source code to the port can be found here: ruby.tgz

export   # pls choose a mirror near you
# setenv CVSROOT
cd :/usr/ports/lang/ruby
cvs up -rHEAD .
make package
Now we can install it:
sudo su
setenv PKG_PATH './:'
# or:  export PKG_PATH='./:'
cd /usr/packages/i386/all
pkg_add ruby- 
# Or, of you already have ruby installed, try:  pkg_add -r ruby-
And for a bonus, lets install Ruby-On-Rails:
pkg_add ruby-gems ruby-iconv-  mysql-server mysql-client

# Update gems to version 1.0.1, apparently needed for rails 2.0.2 but will break things like ruby-openid-1.1.4
gem update --system

gem install rails
# For Rails 1.2.6
# gem install -v 1.2.6 rails

# Now let's optimize ruby for mysql
gem install mysql

# finally, mongrel rocks
gem install mongrel --include-dependencies
gem install mongrel_cluster

If this is a new MySQL install, don’t forget to follow the instructions in /usr/local/share/doc/mysql/README.OpenBSD.


Digg! Delicious! Technorati Blinklist Furl Reddit

Leave a response

  1. Cameron RitterJanuary 03, 2008 @ 03:36 PM
    Hi, I have truble with your binary. fatal issues in installing ruby- Do I need prepare things early or any special thing? Thank you
  2. faceJanuary 04, 2008 @ 12:01 PM
    I don't have instructions for installing my binary listed above. You should be able to download the binaries to a local directory and follow the install instructions above. However, you can use pkg_add without even downloading anything:
    sudo su
    export PKG_PATH=""
    # or, setenv PKG_PATH ""
    pkg_add ruby-
    That should do the trick to install my i386 binary on a i386 OpenBSD 4.2 system. Thanks, -face

Hint: Comments now accept textile.