Having a hard time installing `eth` gem in a plugin in production

I’m having to install the eth gem in a plugin but really having a hard time doing that. It depends on a bunch of other gems, a few of which have native extensions. Here’s the dependency list if you wanna give it a try.

gem 'pkg-config', '1.4.7', require: false
gem 'mkmfmf', '0.4', require: false
gem 'keccak', '1.3.0', require: false
gem 'zip', '2.0.2', require: false
gem 'mini_portile2', '2.7.0', require: false
gem 'rbsecp256k1', '5.1.0', require: false
gem 'konstructor', '1.0.2', require: false
gem 'ffi', '1.15.5', require: false
gem 'ffi-compiler', '1.0.1', require: false
gem 'scrypt', '3.0.7', require: false
gem 'eth', '0.5.1', require: false
gem 'siwe', '1.0.0', require: false

The issue is with rbsecp256k1. It tries to require mini_portile2 for building its native extensions but can’t find it inspite of it being installed and required. I’ve gone to great lengths, like forking the gem and requiring the absolute path manually, also tried to literally clone the mini_portile2 into rbsecp256k1 and requiring it from there but nothing has worked yet.

Any help would be greatly appreciated.


I finally managed to find a workaround. I’ll share in a bit.


Here’s what I did. I logged in to the server and entered the docker container.

  • create a folder called gems

  • create a subdirectory 2.7.5 (ruby version used by production discourse on tests-passed)

  • cd back to gems folder

  • Run commands in this fashion

    gem install pkg-config -v 1.4.7 -i $RUBY_VERSION --no-document --ignore- 
    dependencies --no-user-install
    gem install mkmfmf -v 0.4 -i $RUBY_VERSION --no-document --ignore-dependencies 

    Note: these are the exact same commands discourse runs(tries to run, but fails) to install the gems.

  • Now zip this folder.

  • Exit the docker container and copy the zip outside the docker container using docker cp command.

  • Connect to your server via filezilla or vscode and download the zip.

  • extract it to the root folder of your plugin. So your plugin folder would now have the gems directory.

  • Now push the gems folder with the plugin to github.

Now when you do a rebuild on discourse with this plugin, discourse will use the dependencies you supplied it and won’t try to install them. This is a temporary workaround and would need to be re-done once discourse bumps the ruby version.

But here’s the big question, why do the same commands that work when running from the terminal fail when discourse tries to run it. It would be really worth looking into and I hope there’s a simple fix.


I fixed this recently in


Awesome, Thanks. :clap:

Would you be able to cherry pick this fix to stable @tgxworld ?

1 Like

Have done so in