TIL: Update git dependencies in mruby

by Paweł Świątkowski
25 May 2025

In mruby, you can have a dependency sources from Github or git, not from the canonical mrbgems list. It looks like this:

MRuby::Build.new do |conf|
  conf.toolchain :gcc

  conf.gem core: 'mruby-bin-mruby'
  conf.gem github: 'katafrakt/mruby-termbox2', branch: 'main'
end

The problem here is that when the dependency is fetched during the build step, it stays pinned to the commit which was fetched. There is no bundle update to run and the conf.gem does not accept ref as the parameter. So how can I force the dependency to update?

It turns out it involves manual deletion of the cache. The cached source files lie inside the mruby directory (not the project itself) under build/host/mrbgems/<gem-name>. So all it takes is to remove the cached directory and run the build again.

In my case:

rm -rf mruby/build/host/mrbgems/mruby-termbox2