Since I started blogging again a while ago I decided to forgo the usual Wordpress route and try this thing called Octopress. I have to say, I am extremely delighted, and the fact that I can host it all on Github for free, well that is just the Siracha on my Chipotle.
Octopress also makes previewing your site and deploying it to Github super simple. Want to preview the site locally and auto generate the appropriate files when things change, well, just run:
Want to generate and deploy your site to Github. After some simple config, it is as simple as:
This all worked great, and makes blogging a joy. But as you might have noticed, I said worked and not work. The reason is that, after upgrading to Mac OSX El Capitan, commands like
rake preview and
rake watch fails with the following error:
1 2 3 4 5 6 7
I went on a search for the answer or to confirm that this is actually a bug on El Capitan. After some time I landed on this Octopress issue on Github. So there it is, confirmed. Now what though?
First thing I did was to check my Ruby version.
Having a look over on the Ruby site I noticed that the latest version of the language is in fact version
2.2.3. After multiple failed attempts at upgrading with Homebrew I decided to have a look at rbenv. From the repo:
Use rbenv to pick a Ruby version for your application and guarantee that your development environment matches production.
This is essentially the same as virtualenv, which I use daily for the Django projects I work on. Essentially it creates and isolated environment for your project in which you control the version of Ruby etc. Installing rbenv is a dead simple process, just run the following(assuming you have Homebrew installed):
You can see that apart from rbenv itself, it also installs ruby-build as a plugin to rbenv. This is what is going to allow us to install various versions of Ruby on the same machine, and then use rbenv, to specify the version we want to use for our current project.
Once the above completes, go ahead and install the latest Ruby version using:
Next we are going to specify that we want to use this version for our Octopress blog. To do so, head into the root of your Octopress blog folder and run:
If you now check your Ruby version, you should see the following:
Nice! But did it fix anything? Well, first things first. Because we have created this isolated virtual environment if you will, we need to install Octopress' dependencies again so, go ahead and run:
1 2 3 4
Once bundler has installed all the things, we can test whether the
rake tasks work.
1 2 3 4 5 6 7 8 9 10 11 12
And It Works!
This leads me to believe that there is a bug in the Ruby version that comes with El Capitan and the posix-spawn dependency that Octopress uses in the
rake watch code blocks.
Hopefully this is soon resolved but, working with virtual environments per project and being able to control the versions of the dependencies you use is a much better way of working anyhow so, we need not hold our breath.