# Calling Jekyll From Ruby/Rails

**URL:** <https://talk.jekyllrb.com/t/calling-jekyll-from-ruby-rails/739>\
**Category:** Help\
**Created:** [July 5, 2017, 3:29am UTC](https://talk.jekyllrb.com/t/calling-jekyll-from-ruby-rails/739 "2017-07-05T03:29:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ralph](https://avatars.discourse-cdn.com/v4/letter/r/f475e1/32.png) [@ralph](https://talk.jekyllrb.com/u/ralph)\
**Post date:** [July 5, 2017, 3:29am UTC](https://talk.jekyllrb.com/t/calling-jekyll-from-ruby-rails/739/1 "2017-07-05T03:29:51Z")

</div>

I’m attempting to call the jekyll binary from a ruby method inside a rails app. Running ‘jekyll new’ and ‘jekyll build’ from the console by hand works fine. Running `jekyll new` from within ruby works fine but `jekyll build` brings back this error:

“Configuration file: /Users/x/code/blog-6/\_config.yml\n” + “jekyll 3.4.3 | Error: The minima theme could not be found.\n”

I’m thinking this is a problem caused by environment variables or possibly RVM but haven’t had any luck in days of trying to track it down.

Any Ideas?

---

<div class="post-metadata">

**Author:** ![pabloduo](https://avatars.discourse-cdn.com/v4/letter/p/2bfe46/32.png) [@pabloduo](https://talk.jekyllrb.com/u/pabloduo)\
**Post date:** [July 5, 2017, 6:52am UTC](https://talk.jekyllrb.com/t/calling-jekyll-from-ruby-rails/739/2 "2017-07-05T06:52:51Z")

</div>

I think you might need to add ‘minima’ gem to your Gemfile. Since you are calling to Jekyll via command-line from within Rails app your `$LOAD_PATH` must have path to `minima` theme… Because you’re spawning a new child process out of your Rails app, that child process inherits all environment variables and imho it is the culprit of the error you’re seeing.

You can try to trace out `$LOAD_PATH` variable before calling to Jekyll to confirm whether you’re missing path to `minima` gem or not…

Hope it helps.

---

<div class="post-metadata">

**Author:** ![ralph](https://avatars.discourse-cdn.com/v4/letter/r/f475e1/32.png) [@ralph](https://talk.jekyllrb.com/u/ralph)\
**Post date:** [July 6, 2017, 5:48am UTC](https://talk.jekyllrb.com/t/calling-jekyll-from-ruby-rails/739/3 "2017-07-06T05:48:41Z")

</div>

Awesome that was exactly it @pabloduo ☀

I’ve stuffed the jekyll-required gems into the Rails app’s Gemfile and got it to build successfully. It feels wrong adding the gems into the RoR app’s Gemfile, will I run into further problems if I don’t get ruby to execute in the context of jekyll?

---

<div class="post-metadata">

**Author:** ![pabloduo](https://avatars.discourse-cdn.com/v4/letter/p/2bfe46/32.png) [@pabloduo](https://talk.jekyllrb.com/u/pabloduo)\
**Post date:** [July 6, 2017, 7:04am UTC](https://talk.jekyllrb.com/t/calling-jekyll-from-ruby-rails/739/4 "2017-07-06T07:04:01Z")

</div>

Yay! Glad it helped! 😃

Conceptually Jekyll is a Ruby gem and it should be delivering its features in any Ruby-alike environment (including RoR)…

But… Jekyll by default is assumed to be run from the console (your user account must have permissions to do that) and RoR is by default assumed to be run with least privileges. IMHO, these assumptions are conflicting and therefore chances are you might run into some quirks. And if that won’t happen today it well might happen tomorrow, unless that setup is OFFICIALLY supported by Jekyll with corresponding test coverage and validations.

You still can run things your way, as long as it reliably works for you and your customers. 😉

Hope that makes sense.

---

<div class="post-metadata">

**Author:** ![jordila](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/jordila/32/3488_2.png) [@jordila](https://talk.jekyllrb.com/u/jordila)\
**Post date:** [April 5, 2021, 4:55pm UTC](https://talk.jekyllrb.com/t/calling-jekyll-from-ruby-rails/739/5 "2021-04-05T16:55:33Z")

</div>

Just reactivating this thread…in order to challenge myself, and coupling Jekyll + Ruby on Rails [à-la Alan Reid](https://r3id.medium.com/setting-up-rails-and-jekyll-part-1-5bbc9cde6127) ?

- [] Part 1, accomplished ( RoR v6 )
- [] Part 2, …+ Jekyll coupling ?

well… i don’t see any coupling there,at a first look. It’s just Matrioshka’s game, seems to me.
