# Installing a git-based gem from a discourse plugin

**URL:** <https://meta.discourse.org/t/installing-a-git-based-gem-from-a-discourse-plugin/238657>\
**Category:** Development\
**Created:** [September 10, 2022, 7:05pm UTC](https://meta.discourse.org/t/installing-a-git-based-gem-from-a-discourse-plugin/238657 "2022-09-10T19:05:08Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)\
**Post date:** [September 10, 2022, 7:31pm UTC](https://meta.discourse.org/t/installing-a-git-based-gem-from-a-discourse-plugin/238657/2 "2022-09-10T19:31:56Z")

</div>

> [@](#):
>
> ```ruby
> gem 'omniauth-ldap-i18n', '1.0.0'
> 
> ```

Using this in the `plugin.rb` file will always try to fetch the gem from Rubygems - it won’t use the locally installed version. I think your options are:

1. Push your customized version of the gem to rubygems, remove the `>> Gemfile` hack, and use the `plugin.rb` `gem` API to install it.

2. Remove the `>> Gemfile` hack, set up a private rubygems server and install like:

3. Add Git support to [our plugin gem loader](https://github.com/discourse/discourse/blob/415535d577057676e46a5e4ec90a3ea3ec2bd27a/lib/plugin_gem.rb#L16-L17). If you can do it without affecting existing functionality, this would be #pr-welcome

4. Remove the `gem` method call from `plugin.rb`. Since you have the `>> Gemfile` hack, the gem should be automatically available within Discourse. But I would stress that this is a hack - we can’t guarantee overriding core files like this will work perfectly forever.

---

_[View the full topic](https://meta.discourse.org/t/installing-a-git-based-gem-from-a-discourse-plugin/238657)._
