Fixing gollum installation under macOS 10.13.1 High Sierra 

Published 2017-12-17 on flowinho.io

category | code ruby macos icu4c unicode homebrew

I’m currently researching a way to setup a personal wiki to outsource some information from my brain. While database-driven wikis like MediaWiki are interesting i prefer file-based cms because of their sheer simplicity. That’s what brought my attention to wiki cms like GitHub Gollum.

However sudo gem install gollum fails under macOS 10.13.1 - this blog post is to document a working solution.

Install icu4u

Building native gem extensions for Gollum requires extended support for Unicode. This can be achieved by installing the ICU - International Components for Unicode - brew cask. If you haven’t installed homebrew on your dev host yet, you can install it using the following terminal command

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

After completion install icu4c:

brew install icu4c

==> Downloading https://homebrew.bintray.com/bottles/icu4c-60.1.high_sierra.bott
==> Downloading from https://akamai.bintray.com/e1/e15405fead705403edfc87b9b0ed7
######################################################################## 100.0%
==> Pouring icu4c-60.1.high_sierra.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS provides libicucore.dylib (but nothing else).

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.bash_profile
  echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.bash_profile

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/icu4c/lib
    CPPFLAGS: -I/usr/local/opt/icu4c/include

==> Summary
🍺  /usr/local/Cellar/icu4c/60.1: 249 files, 66.9MB

Setup charlock_holmes

icu4u provides extended unicode support, however the ruby runtime cannot necessarily detect all of them. This is solved by installing charlock_holmes and pointing it to your icu4u installation.

sudo gem install charlock_holmes -- --with-icu-dir=/opt/local

Building native extensions with: '--with-icu-dir=/opt/local'
This could take a while...
Successfully installed charlock_holmes-0.7.5
Parsing documentation for charlock_holmes-0.7.5
Installing ri documentation for charlock_holmes-0.7.5
Done installing documentation for charlock_holmes after 0 seconds
1 gem installed

Setup and test gollum

Gollum should install as expected now:

sudo gem install gollum
...
...
Done installing documentation for posix-spawn, mime-types-data, mime-types, diff-lcs, gitlab-grit, gollum-grit_adapter, mini_portile2, nokogiri, stringex, sanitize, github-markup, gemojione, gollum-lib, kramdown, rack, tilt, rack-protection, sinatra, mustache, useragent, gollum after 535 seconds
21 gems installed

Nice!

Let’s give it a try:

mkdir test && cd test && git init && gollum

[2017-12-06 14:05:15] INFO  WEBrick 1.3.1
[2017-12-06 14:05:15] INFO  ruby 2.4.1 (2017-03-22) [x86_64-darwin16]
== Sinatra (v1.4.8) has taken the stage on 4567 for development with backup from WEBrick
[2017-12-06 14:05:15] INFO  WEBrick::HTTPServer#start: pid=33110 port=4567

Open a webbrowser and point it to http://localhost:4567/. Welcome to your new gollum wiki!