Installing Ruby 1.9.2 on FreeBSD

06 Jan

I’m new to FreeBSD and I’m really loving it. As a Ruby developer here’s how to get started with FreeBSD.

Some things you might need, before you install Ruby
FreeBSD comes with csh by default, which is fun but its a bit cryptic. You might want to simply use the bash shell. The following installations may take a long time to complete because we are building everything from source.

To Build and install Bash

# whereis bash
bash: /usr/ports/shells/bash
# cd /usr/ports/shells/bash
# make install clean

To use bash, type:

# /usr/local/bin/bash

To make bash the default shell:

# chsh -s /usr/local/bin/bash {username}
# chsh -s /usr/local/bin/bash obi

To Build and Install wget

# whereis wget
wget: /usr/ports/ftp/wget 
# cd /usr/ports/ftp/wget
# make install clean

To Build and install python
We will need Python to build Git later.

# whereis python
python: /usr/ports/lang/python
# cd /usr/ports/lang/python
# make install clean

To Build and install Git
Git source mirror.

# wget
# tar xzf git-
# cd git-
# ./configure
# gmake
# gmake install
#git version
git version

To Build and install Ruby 1.9.2

# wget
# tar xzvf ruby-1.9.2-p136.tar.gz
# cd ruby-1.9.2-p136
# ./configure
# make install
# ruby -v
ruby 1.9.2p136 (2010-12-25 revision 30365) [i386-freebsd8.1]
# gem -v
# irb -v
irb 0.9.6(09/06/30)

We are all set. We now have the same Ruby environment on BSD as we use on Linux. I used this setup to test Ragios on FreeBSD. Bundler installed all the required gems with no problems.

If I missed something something in this write-up, please let me know in the comments.
Happy New Year!


Tags: , ,

  • AnonymousCow


    # portinstall lang/ruby19

    be easier?

  • Public

    Depends on what you’re trying to do. FreeBSD’s port system has its own ideas about what and where things go. For example, it insists on putting gems in the gem 1.8 library even after you’ve installed 1.9 and the gems should go in the 1.9 library. The ports system is fine if you want to run old ruby stuff, but worse than useless if you want to run today’s ruby things, like rvm and the like.

  • Fuzz Leonard

     Um, no. You just have to know how to use the ports system. Put this in /etc/make.conf:


    Good to go!

  • Ruby hater, actually

    Thanks, that works.

  • Jarrad Jackson

    Fantastic! Thanks!

  • Emma


  • dana tassler

     Why is this bad? Please explain.

Premium Wordpress Plugin