Installing SproutCore on Ubuntu on VirtualBox

If you check out the installation instructions for SproutCore you will notice that Windows developers are not really catered for (though I am sure it can be done). I also noticed some Windows issues in the Sproutcore forum. More evidence of the Windows/Unix disconnect.

Having been impressed by VirtualBox recently, I figured it might be easier to use VirtualBox and Ubuntu.

Here’s how it went. I ran up a new VirtualBox image and installed Ubuntu. Very easy; just point VirtualBox to the Ubuntu install iso. This worked, except that Ubuntu did not recognize the video driver and defaulted to 800 x 600 resolution. Solution: install dkms in Synaptic (or using apt-get); then install the VirtualBox Linux Additions. That gave me 1024 x 768, which is good enough.

Next, you need to install Ruby (developer version) (use sudo or root)

apt-get install ruby

apt-get install rubygems

apt-get install ruby1.8-dev

and some build tools as one of the SproutCore dependencies (hpricot) calls make when installed:

apt-get install build-essential

I thought that would be enough, but my first go at installing SproutCore failed, apparently because gem is not on the path. Although it seemed to work, I got “command not found” when running sproutcore. So:

export PATH=$PATH:/var/lib/gems/1.8/bin

Now you can install SproutCore:

gem install sproutcore

Several components, such as hpricot, ask which version to install. I chose the variant designated (ruby).

After that, the Hello World tutorial ran exactly as expected.

By the way, although this example makes it look as if SproutCore is a dynamic server framework, it is not. The usual way to deploy a SproutCore application is as static files; the server arrangement is for debugging.

Note: the command above only amends the path for the current session. To make it permanent, I added the following to lines to the end of /etc/profile (needs root permissions to edit)*:

export PATH

*See comment below for an even better suggestion.

12 thoughts on “Installing SproutCore on Ubuntu on VirtualBox”

  1. Thanks for this – I was scratching my head for a while trying to get SproutCore installed on my Ubuntu box. 🙂

  2. Tim,

    I’d suggest moving your additions to /etc/profile to /etc/profile.d/ and chmod +x the script.

    This way, you can have application specific configs and not touch /etc/profile, which may get updated in the course of normal system updates and blow away your modifications.


  3. Hi Tim,

    Thanks very much for your post. I’m having some trouble getting this to work. I got a VMWare appliance with Ubuntu pre-installed. I then tried to follow the steps you suggested.

    It looked like everything worked until I got to this step:

    gem install sproutcore

    at this point, I got this error message:
    Bulk updating Gem source index for:
    ERROR: While executing gem … (Gem::GemNotFoundException)
    Could not find sproutcore (>0) in any repository

    Can you suggest what I might be doing wrong?



  4. I managed to get this working.

    I re-ran the “apt-get install ruby1.8-dev” step (not sure if this was necessary) then waited a while for the deferred processing to complete (not sure if that was necessary either 🙂

    Then I ran “gem install sproutcore” a second time and this time everything worked perfectly.

    Thank you very much for your post! I tried using SproutCore under Windows but was unsuccessful so I was very happy to find the information you provided here.

  5. After running: sudo gem install sproutcore

    I get this error…

    ERROR: Error installing sproutcore:
    merb-core requires RubyGems version >= 1.3.0

    Any ideas?

    I’m running Ubuntu Ibex, natively on an Asus Eee pc 1000.

    I’ve already run through all of the other installations…

  6. I got the same error as Got_Rice64 after went through all of the steps and ran
    >>sudo gem install sproutcore

    ERROR: Error installing sproutcore:
    merb-core requires RubyGems version >= 1.3.0

  7. Got_Rice64 & hninh, try the following to update your version:

    gem install rubygems-update

  8. fwiw… i’m on Ubuntu 8.04-1 and i didn’t have ruby, libxml2 or libxslt installed for whatever reason, i also had problems with the error message: /usr/bin/gem:23: uninitialized constant Gem::GemRunner (NameError), so the process i used was, as root:

    1. install required packages via apt-get:

    apt-get install ruby rubygems ruby1.8-dev build-essentials libxml2-dev libxslt1-dev

    (though i’m pretty sure i had build-essentials already installed.)

    2. update ruby gems with:

    gem install rubygems-update
    gem update --system

    3. unhork /usr/bin/gem using the process defined @ by modifying the top of /usr/bin/gem to look like:

    require 'rubygems'
    require 'rubygems/gem_runner'

    4. set the path

    export PATH=$PATH:/var/lib/gems/1.8/bin

    5. install the sproutcore gem:

    gem install sproutcore

    and get ready to type ‘Y’ a lot, except for when you have to type a number.

    after this, the hello world example worked well for me.

  9. On Ubuntu 10x the following worked for me:
    sudo install ruby rubygems ruby1.8-dev build-essential
    sudo gem install rubygems-update
    export PATH
    cd /
    cd var/lib/gems/1.8/bin
    sudo ./update_rubygems
    sudo gem install sproutcore
    cd /
    cd var/www
    sudo mkdir sproutcore
    sudo sc-init hello_world

    Good luck!

    Eric Jarvies

Comments are closed.