eee I wanted to have jekyll always running on my Macbook, so that I could preview my posts before pushing them to my Github Pages site. Here’s how I set it up with a Launch Agent. (The challenging parts were learning how to use Launch Agents to run shell scripts and learning how to run Jekyll from a non-login shell.)

I’m using chruby to manage multiple versions of Ruby, and bundle to manage multiple gem levels, and I use Homebrew as a package manager. YMMV if you use other tools. I’ve previously confirmed that I can manually launch Jekyll for both of my sites.


I have two sites: and, at and respectively.


create ~/Library/LaunchAgents/com.kleinfelter.jekyll.k4kpk.plist:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">


Similarly, create ~/Library/LaunchAgents/com.kleinfelter.jekyll.kleinfelter.plist, with ‘kleinfelter’ substituted for ‘k4kpk’.


/Users/kevin/Sync/Sites/ should contain:

source /Users/kevin/.bash_profile
cd /Users/kevin/Sync/Sites/
chruby 2.4.2
bundle exec jekyll serve --incremental


  • Test it with: launchctl start com.kleinfelter.jekyll.k4kpk.plist

  • Check output in /tmp/k4kpk.jekyll.err and /tmp/kleinfelter.jekyll.err


I had to add this to my Gemfile to prevent an “invalid byte sequence in US-ASCII” error:

Encoding.default_external = Encoding::UTF_8


I also added this to my _config.yml

encoding: utf-8