# Enabling YJIT via Template Doesn't Work

**URL:** https://meta.discourse.org/t/enabling-yjit-via-template-doesnt-work/401815
**Category:** Support
**Created:** [April 29, 2026, 2:26pm UTC](https://meta.discourse.org/t/enabling-yjit-via-template-doesnt-work/401815 "2026-04-29T14:26:31Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [April 30, 2026, 3:52pm UTC](https://meta.discourse.org/t/enabling-yjit-via-template-doesnt-work/401815/4 "2026-04-30T15:52:21Z")

</div>

> [@cedric\_chin](#):
>
> Looking at the presence of an env var doesn’t tell you anything about whether Ruby is currently running with YJIT enabled.

This is wrong. At the Ruby level, the ENV var is one of the official toggles, see the Ruby official documentation about this here

> **[yjit - Documentation for Ruby 3.4](https://docs.ruby-lang.org/en/3.4/yjit/yjit_md.html#:~:text=exits-,Note,practical)**
>
> yjit: yjit. user-images.

> [@cedric\_chin](#):
>
> In this particular case, the env var is set but something else was clobbering the variable Rails uses to enable (or disable) YJIT on startup! (Or at least … that’s my suspicion).

This is wrong as `DISCOURSE_YJIT_ENABLED` only feeds `GlobalSetting.yjit_enabled` → `config.yjit` in `config/application.rb`. Rails uses that to enable YJIT _if it isn’t already on_. It does not disable an already-enabled YJIT. So when the env var is set, `DISCOURSE_YJIT_ENABLED` has nothing to do.

To further prove my point I wrote a plugin that returns if YJIT is enabled on my web process:

[https://discourse-on-a-pi5.falco.dev/ruby-info](https://discourse-on-a-pi5.falco.dev/ruby-info)

You are confused about the Rails level toggle, which is unnecessary as use the Ruby level toggle.

---

_[View the full topic](https://meta.discourse.org/t/enabling-yjit-via-template-doesnt-work/401815)._
