Installing Octopress (and Ruby via RVM) on a Lion box that has Xcode 4.2

In my quest to move away from Wordpress (and PHP/MySQL, which reminds me far too much of 1999 for my comfort), I'm evaluating several static site blog solutions to migrate this blog to and to use for a couple of other blogs that I want to set up for next year. As part of the process, I wanted to give Octopress a shot. Octopress is a static site blogging solution built on mojombo/jekyll – the solution that powers GitHub Pages. The beauty of it is that you can simply deploy your blog to GitHub Pages, and even use a custom domain, simply by pushing to your repository (GitHub will pass your repository through Jekyll automatically–simples!)

The problem is that there are apparently issues with installing the dependencies on a box running Lion with Xcode 4.2. The following solution worked for me. I hacked it together from that StackOverflow thread as well as the Octopress Setup Guide:

  1. Install RVM:
    bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
  2. Add RVM to your shell as a function:
    echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
    source ~/.bash_profile
  3. Use RVM to install the latest Ruby:
    rvm install 1.9.3 --with-gcc=clang
  4. …and use it:
    rvm use 1.9.3
    (This also resulted in the latest ruby gems (1.8.10 at the time of writing) being installed for me
  5. Download Octopress:
    git clone git://github.com/imathis/octopress.git octopress
  6. Change your current working directory to the octopress folder:
    cd octopress
  7. You should get an alert from RVM, asking you if you want to trust the .rvmrc file in the folder. Respond with (y)es, and you should get an error:

    WARN: ruby ruby-1.9.2-p290 is not installed.
    To install do: 'rvm install ruby-1.9.2-p290'

    Resolved this by editing the .rvmrc file and changing its contents to read rvm 1.9.3 instead of rvm 1.9.2 (RVM will ask you to re-confirm that you want to trust the file after you've updated it.)

  8. Check the Ruby version
    ruby --version
    . You should see ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]
  9. Install dependencies:

    gem install bundler
    bundle install
  10. Install the default theme:
    rake install
  11. To test your new blog:
    rake preview
    then hit it in the browser at http://localhost:4000
  12. To learn how to deploy your site, etc., follow the links in the "Next steps" section of The Octopress Setup Guide (by the way, why have people stopped adding anchors or ids to their headings? One small id for you, one big deep link for everyone else.) :)

That's it, that should get you up and running with Octopress (and the latest Ruby–as of this writing, 1.9.3-p0), on a box running OS X Lion and Xcode 4.2.x.

Comments