# \[ruby-talk:443099\] How to pack and distribute ruby software to users with no ruby environment?

**URL:** https://rubytalk.org/t/ruby-talk-443099-how-to-pack-and-distribute-ruby-software-to-users-with-no-ruby-environment/76086
**Category:** ruby-talk
**Created:** [1 November 2022 08:33 UTC](https://rubytalk.org/t/ruby-talk-443099-how-to-pack-and-distribute-ruby-software-to-users-with-no-ruby-environment/76086 "2022-11-01T08:33:50Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![homodeluna](https://avatars.discourse-cdn.com/v4/letter/h/e274bd/32.png) [@homodeluna](https://rubytalk.org/u/homodeluna)
#### Post date: [1 November 2022 08:33 UTC](https://rubytalk.org/t/ruby-talk-443099-how-to-pack-and-distribute-ruby-software-to-users-with-no-ruby-environment/76086/1 "2022-11-01T08:33:50Z")

</div>

I can write some CLI softwares in ruby(for example a curricular scheduler), and run them on my own computer. However when distributing them to other computers, They don’t have a ruby environment, some even aren’t connected to internet. So I had to rewrite it in C++,compile it, and distribute it in binary form.(maybe now I would do the same in crystal)

Is there a way to pack the ruby interpreter, required gems, and source code into a single executable file, so users can simply execute it within one click? There is PyInstaller for python to do that job, I’m wondering for an equivalent in Ruby.  
从 Windows 版邮件\<[https://go.microsoft.com/fwlink/?LinkId=550986&gt;发送](https://go.microsoft.com/fwlink/?LinkId=550986&gt;%E5%8F%91%E9%80%81)

---

<div class="post-metadata">

### Author: ![Benson\_Muite](https://avatars.discourse-cdn.com/v4/letter/b/a698b9/32.png) [@Benson\_Muite](https://rubytalk.org/u/Benson_Muite)
#### Post date: [1 November 2022 08:56 UTC](https://rubytalk.org/t/ruby-talk-443099-how-to-pack-and-distribute-ruby-software-to-users-with-no-ruby-environment/76086/2 "2022-11-01T08:56:53Z")

</div>

See:  
[https://phusion.github.io/traveling-ruby/](https://phusion.github.io/traveling-ruby/)

> **[GitHub - pmq20/ruby-packer: Packing your Ruby application into a single...](https://github.com/pmq20/ruby-packer)**
>
> Packing your Ruby application into a single executable. - GitHub - pmq20/ruby-packer: Packing your Ruby application into a single executable.

> **···**
>
> On 11/1/22 11:33, 王 卓强 wrote:
> 
> > and distribute it in binary form.(maybe now I would do the same in crystal)
> > 
> > Is there a way to pack the ruby interpreter, required gems, and source code into a single executable file, so users can simply execute it within one click? There is PyInstaller for python to do that job, I’m wondering for an equivalent in Ruby.

---

<div class="post-metadata">

### Author: ![Frank\_J\_Cameron](https://avatars.discourse-cdn.com/v4/letter/f/dc4da7/32.png) [@Frank\_J\_Cameron](https://rubytalk.org/u/Frank_J_Cameron)
#### Post date: [1 November 2022 15:27 UTC](https://rubytalk.org/t/ruby-talk-443099-how-to-pack-and-distribute-ruby-software-to-users-with-no-ruby-environment/76086/3 "2022-11-01T15:27:53Z")

</div>

Other than traveling-ruby and ruby-packer:

I've used mruby to compile a few small, simple utilities (custom Nagios  
plugins):

> **[GitHub - hone/mruby-cli: mruby-cli is a platform to build native command line...](https://github.com/hone/mruby-cli)**
>
> mruby-cli is a platform to build native command line applications for Linux, Windows, and OS X. It provides the tools necessary for building a standalone binary of your application from any machine...

For systems with Java, I have packaged some utilities as jar files:

> **[GitHub - jruby/warbler: Warbler chirpily constructs .war files of your Ruby...](https://github.com/jruby/warbler#label-.war+or+.jar-3F)**
>
> Warbler chirpily constructs .war files of your Ruby applications. - GitHub - jruby/warbler: Warbler chirpily constructs .war files of your Ruby applications.

I've never used it, but Glimmer has a packaging option that uses warbler  
and jpackage to create DMG/PKG, MSI/EXE, and/or DEB/RPM packages (again  
depending on a Java runtime on the target):

> <https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md>

> **···**
>
> On 11/1/22, 王 卓强 \<HOMODELUNA@outlook.com\> wrote:
> 
> > I can write some CLI softwares in ruby(for example a curricular scheduler),  
> > and run them on my own computer. However when distributing them to other  
> > computers, They don’t have a ruby environment, some even aren’t connected to  
> > internet. ...

---

<div class="post-metadata">

### Author: ![Frank\_J\_Cameron](https://avatars.discourse-cdn.com/v4/letter/f/dc4da7/32.png) [@Frank\_J\_Cameron](https://rubytalk.org/u/Frank_J_Cameron)
#### Post date: [1 November 2022 19:05 UTC](https://rubytalk.org/t/ruby-talk-443099-how-to-pack-and-distribute-ruby-software-to-users-with-no-ruby-environment/76086/4 "2022-11-01T19:05:08Z")

</div>

a unique Ruby implementation, compiled to C++ (WIP):

> **[GitHub - natalie-lang/natalie: a work-in-progress Ruby compiler, written in...](https://github.com/natalie-lang/natalie)**
>
> a work-in-progress Ruby compiler, written in Ruby and C++ - GitHub - natalie-lang/natalie: a work-in-progress Ruby compiler, written in Ruby and C++

$ cat examples/hello.rb  
puts 'hello world'

$ bin/natalie examples/hello.rb -c hello  
$ ./hello  
hello world

$ ls -lh hello  
-rwxr-xr-x 1 user user 19M Nov 1 15:01 hello  
$ file hello  
hello: ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux),  
dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2,  
BuildID[sha1]=c298736e605dcebaf676bb363fad3f092e93c9ea, for GNU/Linux  
3.2.0, with debug\_info, not stripped  
$ ldd hello  
&nbsp;&nbsp;linux-vdso.so.1 (0x00007fff78dc1000)  
&nbsp;&nbsp;libstdc++.so.6 =\> /lib/x86\_64-linux-gnu/libstdc++.so.6 (0x00007a1aee57e000)  
&nbsp;&nbsp;libm.so.6 =\> /lib/x86\_64-linux-gnu/libm.so.6 (0x00007a1aee43a000)  
&nbsp;&nbsp;libgcc\_s.so.1 =\> /lib/x86\_64-linux-gnu/libgcc\_s.so.1 (0x00007a1aee420000)  
&nbsp;&nbsp;libpthread.so.0 =\> /lib/x86\_64-linux-gnu/libpthread.so.0 (0x00007a1aee3fe000)  
&nbsp;&nbsp;libc.so.6 =\> /lib/x86\_64-linux-gnu/libc.so.6 (0x00007a1aee239000)  
&nbsp;&nbsp;/lib64/ld-linux-x86-64.so.2 (0x00007a1aeeaa7000)

> **···**
>
> On 11/1/22, 王 卓强 \<HOMODELUNA@outlook.com\> wrote:
> 
> > I can write some CLI softwares in ruby(for example a curricular scheduler),  
> > and run them on my own computer. However when distributing them to other  
> > computers, They don’t have a ruby environment, some even aren’t connected to  
> > internet. So I had to rewrite it in C++,compile it, and distribute it in  
> > binary form.

---

<div class="post-metadata">

### Author: ![Mohit\_Sindhwani1](https://avatars.discourse-cdn.com/v4/letter/m/dbc845/32.png) [@Mohit\_Sindhwani1](https://rubytalk.org/u/Mohit_Sindhwani1)
#### Post date: [2 November 2022 08:12 UTC](https://rubytalk.org/t/ruby-talk-443099-how-to-pack-and-distribute-ruby-software-to-users-with-no-ruby-environment/76086/5 "2022-11-02T08:12:50Z")

</div>

If the system has Java, I agree that JRuby is a good option (assuming you don't use native gems). I wrote a post here on how to package Ruby scripts into JAR files at this page: [JRuby on Windows: Day 2 - Creating Executable JARS](https://notepad.onghu.com/2021/jruby-win-day2-creating-jar-files/)

It's part of my series of posts on JRuby all of which are linked from the write-up on Why JRuby here: [Why we like to use JRuby](https://notepad.onghu.com/2022/why-we-use-jruby/)

Best Regards,  
Mohit.

> **···**
>
> On 2022-11-1 11:27 pm, Frank J. Cameron wrote:
> 
> > On 11/1/22, 王 卓强 \<HOMODELUNA@outlook.com\> wrote:
> > 
> > > I can write some CLI softwares in ruby(for example a curricular scheduler),  
> > > and run them on my own computer. However when distributing them to other  
> > > computers, They don’t have a ruby environment, some even aren’t connected to  
> > > internet. ...
> > 
> > Other than traveling-ruby and ruby-packer:
> > 
> > I've used mruby to compile a few small, simple utilities (custom Nagios  
> > plugins):
> > 
> > [GitHub - hone/mruby-cli: mruby-cli is a platform to build native command line applications for Linux, Windows, and OS X. It provides the tools necessary for building a standalone binary of your application from any machine. Take advantage of the power of Ruby without the cross-platform dependency headaches that go with it.](https://github.com/hone/mruby-cli)
> > 
> > For systems with Java, I have packaged some utilities as jar files:
> > 
> > [GitHub - jruby/warbler: Warbler chirpily constructs .war files of your Ruby applications.](https://github.com/jruby/warbler#label-.war+or+.jar-3F)
> > 
> > I've never used it, but Glimmer has a packaging option that uses warbler  
> > and jpackage to create DMG/PKG, MSI/EXE, and/or DEB/RPM packages (again  
> > depending on a Java runtime on the target):
> > 
> > [https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/docs/reference/GLIMMER\_PACKAGING\_AND\_DISTRIBUTION.md](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md)

---

<div class="post-metadata">

### Author: ![AndyObtiva](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/andyobtiva/32/2375_2.png) [@AndyObtiva](https://rubytalk.org/u/AndyObtiva)
#### Post date: [5 November 2022 20:59 UTC](https://rubytalk.org/t/ruby-talk-443099-how-to-pack-and-distribute-ruby-software-to-users-with-no-ruby-environment/76086/6 "2022-11-05T20:59:05Z")

</div>

> I've never used it, but Glimmer has a packaging option that uses warbler  
> and jpackage to create DMG/PKG, MSI/EXE, and/or DEB/RPM packages (again  
> depending on a Java runtime on the target):

> <https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md>

Glimmer DSL for SWT packaging does not depend on a Java runtime on the  
target. It actually packages the JRE too (Java Runtime Environment), so  
when users install the app, all of Java, JRuby, and Ruby Gems are  
automatically installed on their machine into the application directory,  
and the users won't even know that Java or JRuby were installed when  
launching the app. They'll just think they're launching a native  
application.

> **···**
>
> On Wed, Nov 2, 2022 at 4:13 AM Mohit Sindhwani \<mo\_mail@onghu.com\> wrote:
> 
> > On 2022-11-1 11:27 pm, Frank J. Cameron wrote:  
> > \> On 11/1/22, 王 卓强 \<HOMODELUNA@outlook.com\> wrote:  
> > \>\> I can write some CLI softwares in ruby(for example a curricular  
> > scheduler),  
> > \>\> and run them on my own computer. However when distributing them to other  
> > \>\> computers, They don’t have a ruby environment, some even aren’t  
> > connected to  
> > \>\> internet. ...  
> > \> Other than traveling-ruby and ruby-packer:  
> > \>  
> > \> I've used mruby to compile a few small, simple utilities (custom Nagios  
> > \> plugins):  
> > \>  
> > \> [GitHub - hone/mruby-cli: mruby-cli is a platform to build native command line applications for Linux, Windows, and OS X. It provides the tools necessary for building a standalone binary of your application from any machine. Take advantage of the power of Ruby without the cross-platform dependency headaches that go with it.](https://github.com/hone/mruby-cli)  
> > \>  
> > \> For systems with Java, I have packaged some utilities as jar files:  
> > \>  
> > \> [GitHub - jruby/warbler: Warbler chirpily constructs .war files of your Ruby applications.](https://github.com/jruby/warbler#label-.war+or+.jar-3F)  
> > \>  
> > \> I've never used it, but Glimmer has a packaging option that uses warbler  
> > \> and jpackage to create DMG/PKG, MSI/EXE, and/or DEB/RPM packages (again  
> > \> depending on a Java runtime on the target):  
> > \>  
> > \>  
> > [https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/docs/reference/GLIMMER\_PACKAGING\_AND\_DISTRIBUTION.md](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md)
> > 
> > If the system has Java, I agree that JRuby is a good option (assuming  
> > you don't use native gems). I wrote a post here on how to package Ruby  
> > scripts into JAR files at this page:  
> > [JRuby on Windows: Day 2 - Creating Executable JARS](https://notepad.onghu.com/2021/jruby-win-day2-creating-jar-files/)
> > 
> > It's part of my series of posts on JRuby all of which are linked from  
> > the write-up on Why JRuby here:  
> > [Why we like to use JRuby](https://notepad.onghu.com/2022/why-we-use-jruby/)
> > 
> > Best Regards,  
> > Mohit.
> > 
> > Unsubscribe: \<mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe\>  
> > \<[http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt](http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt);
> 
> --  
> Andy Maleh
> 
> LinkedIn: [Andy Maleh - Senior Developer - Lexop | LinkedIn](https://www.linkedin.com/in/andymaleh)  
> \<[https://www.linkedin.com/in/andymaleh&gt](https://www.linkedin.com/in/andymaleh&gt);  
> Blog: [http://andymaleh.blogspot.com](http://andymaleh.blogspot.com)  
> GitHub: [AndyObtiva (Andy Maleh) · GitHub](http://www.github.com/AndyObtiva)  
> Twitter: @AndyObtiva \<[https://twitter.com/AndyObtiva&gt](https://twitter.com/AndyObtiva&gt);
