how to run jekyll's pygmentize on windows

Feb 14, 2010

Updated 06/14/2010 – This is a quick patch created by Jon at RubyInstaller Google Group.

What You Need


Installing Ruby, jekyll, and Python should be self explanatory. I installed RubyInstaller 1.8.7 to C:\Ruby187\ and Python 2.6.5 to C:\Python26\.

Modify the code in albino.rb and highlight.rb from C:\Ruby187\lib\ruby\gems\1.8\gems\jekyll-0.5.7\lib\jekyll\ using the following gists:

Be sure not to just replace the entire code, just the portions of the code. If you’re using Ruby 1.9.1 or your Ruby path is different, drill down to the corresponding path.

I created a folder called ‘Scripts’ under C:\Python26. I added C:\Python26 and C:\Python26\Scripts to the PATH environment variable.

In order to install pygments, you need to install easy_install which is included in setuptools. Download the source (setuptools-0.6c11.tar.gz) and egg (setuptools-0.6c11-py2.6.egg). Extract from setuptools-0.6.c11.tar.gz to the same folder as setuptools-0.6c11-py2.6.egg. Open up a command prompt, navigate to the folder with the egg file and run:

python setuptools-0.6c11-py2.6.egg

This will add easy_install.exe and other files to your C:\Python26\Scripts folder.

Now to install pygments, simply run this command:

easy_install Pygments

According to Jon, easy_install does not create a wrapper for the Pygmentize script, so creating a batch file pygmentize.bat under C:\Python26\Scripts should do the trick. Add this command to the batch file:

@python.exe %~dp0pygmentize %*

Now when running jekyll locally, you should be able to see the pygmentize highlights

pygmentize on windows