# Plans for compiling Ruby to binary bytecode?

**URL:** <https://www.ruby-forum.com/t/plans-for-compiling-ruby-to-binary-bytecode/136714>\
**Category:** Ruby\
**Created:** [May 5, 2008, 8:51pm UTC](https://www.ruby-forum.com/t/plans-for-compiling-ruby-to-binary-bytecode/136714 "2008-05-05T20:51:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![josh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@josh](https://www.ruby-forum.com/u/josh)\
**Post date:** [May 5, 2008, 8:51pm UTC](https://www.ruby-forum.com/t/plans-for-compiling-ruby-to-binary-bytecode/136714/1 "2008-05-05T20:51:17Z")

</div>

Greetings,

My understanding is that Ruby internally uses a custom VM (virtual  
machine) to execute. This VM has its own set of instructions  
(bytecode). I was wondering whether or not there were any plans to  
allow one to compile Ruby down to a set of these instructions and stick  
it into a binary file (much like Java, or .NET) and then use the Ruby’s  
VM to execute it?

Thanks,

–JM

---

<div class="post-metadata">

**Author:** ![josh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@josh](https://www.ruby-forum.com/u/josh)\
**Post date:** [May 6, 2008, 1:34pm UTC](https://www.ruby-forum.com/t/plans-for-compiling-ruby-to-binary-bytecode/136714/2 "2008-05-06T13:34:42Z")

</div>

Joshua Melcon wrote:

> Greetings,
> 
> My understanding is that Ruby internally uses a custom VM (virtual  
> machine) to execute. This VM has its own set of instructions  
> (bytecode). I was wondering whether or not there were any plans to  
> allow one to compile Ruby down to a set of these instructions and stick  
> it into a binary file (much like Java, or .NET) and then use the Ruby’s  
> VM to execute it?
> 
> Thanks,
> 
> –JM

You can make an windows executable:  
[http://www.erikveen.dds.nl/rubyscript2exe/index.html](http://www.erikveen.dds.nl/rubyscript2exe/index.html)

---

<div class="post-metadata">

**Author:** ![josh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@josh](https://www.ruby-forum.com/u/josh)\
**Post date:** [May 7, 2008, 3:37pm UTC](https://www.ruby-forum.com/t/plans-for-compiling-ruby-to-binary-bytecode/136714/3 "2008-05-07T15:37:54Z")

</div>

> My understanding is that Ruby internally uses a custom VM (virtual  
> machine) to execute. This VM has its own set of instructions  
> (bytecode).

There are several different Ruby implementations:

- The ‘default’ is MRI (Matz’s Ruby Impl), it’s an interpreter, no  
bytecode
- The “Next Gen” MRI, the 1.9 series includes YARV, which is a VM  
customized towards ruby
- There’s Rubinius, which is a bootstrapped Ruby impl, written almost  
entirely in Ruby, which uses custom bytecode as well
- JRuby is targeted towards JVM and (I think) can run either as an  
interpreter or compile Ruby to Java bytecode.
- IronRuby is a CLI based Ruby Impl.

So, there’s not just plans, the plans have long since been implemented  
🙂 But the standard Ruby implementation currently doesn’t use  
bytecode.  
Hope this helps,  
-tim
