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)*:

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

*See comment below for an even better suggestion.

VN:F [1.9.18_1163]
Rate this post
Rating: 10.0/10 (1 vote cast)
Installing SproutCore on Ubuntu on VirtualBox, 10.0 out of 10 based on 1 rating

Related posts:

  1. Installing Windows 8 developer preview on VirtualBox
  2. Fixing a VirtualBox Windows XP blue screen
  3. VirtualBox is amazing, 50% faster than Virtual PC on my PC
  4. VirtualBox: get today’s update
  5. Ubuntu Hardy Heron – very cool

12 comments to Installing SproutCore on Ubuntu on VirtualBox

  • Just FYI, sproutcore-0.9.10 was just released today that should work on Windows. (Hey 24-hr turnaround on the Windows bug is not so bad.) :-)

    -C

  • Markus Svensson

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

  • velebak

    Tim,

    I’d suggest moving your additions to /etc/profile to /etc/profile.d/sproutcore.sh 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.

    Keith

  • tim

    @Keith

    Thanks for the suggestion; that makes sense.

    Tim

  • Notre

    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: http://gems.rubyforge.org
    ERROR: While executing gem … (Gem::GemNotFoundException)
    Could not find sproutcore (>0) in any repository

    Can you suggest what I might be doing wrong?

    Thanks,

    Notre

  • tim

    @Notre

    You could try:

    gem cleanup
    gem update

    any better?

    Tim

  • Notre

    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.

  • Got_Rice64

    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…

  • hninh

    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

  • Extrinsic

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

    gem install rubygems-update
    update_rubygems

  • meadhbh hamrick

    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 @ http://nickdenardis.com/2008/11/29/fixing-uninitialized-constant-gemgemrunner-nameerror-ubuntu/ by modifying the top of /usr/bin/gem to look like:

    require 'rubygems'
    require 'rubygems/gem_runner'
    #Gem.manage_gems

    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.

  • Eric Jarvies

    On Ubuntu 10x the following worked for me:
    sudo install ruby rubygems ruby1.8-dev build-essential
    sudo gem install rubygems-update
    PATH=$PATH:/var/lib/gems/1.8/bin
    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