{"id":13392861,"url":"https://github.com/pmq20/ruby-packer","last_synced_at":"2025-04-08T04:15:16.303Z","repository":{"id":15087093,"uuid":"77536425","full_name":"pmq20/ruby-packer","owner":"pmq20","description":"Packing your Ruby application into a single executable.","archived":false,"fork":false,"pushed_at":"2023-08-29T12:43:38.000Z","size":56805,"stargazers_count":1560,"open_issues_count":107,"forks_count":99,"subscribers_count":44,"default_branch":"master","last_synced_at":"2024-10-29T17:51:28.951Z","etag":null,"topics":["compiler","ruby","ruby-packer","rubyc","squashfs","windows"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pmq20.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS"}},"created_at":"2016-12-28T13:56:18.000Z","updated_at":"2024-10-28T11:02:17.000Z","dependencies_parsed_at":"2024-01-06T00:14:01.118Z","dependency_job_id":null,"html_url":"https://github.com/pmq20/ruby-packer","commit_stats":null,"previous_names":["pmq20/ruby-compiler"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmq20%2Fruby-packer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmq20%2Fruby-packer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmq20%2Fruby-packer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmq20%2Fruby-packer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pmq20","download_url":"https://codeload.github.com/pmq20/ruby-packer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247339843,"owners_count":20923149,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compiler","ruby","ruby-packer","rubyc","squashfs","windows"],"created_at":"2024-07-30T17:00:38.278Z","updated_at":"2025-04-08T04:15:11.283Z","avatar_url":"https://github.com/pmq20.png","language":"C","funding_links":[],"categories":["C","Awesome Ruby CLIs"],"sub_categories":["Release"],"readme":"# Ruby Packer\n\n*Packing your Ruby application into a single executable.*\n\n[![Windows](https://github.com/pmq20/ruby-packer/workflows/Windows/badge.svg)](https://github.com/pmq20/ruby-packer/actions?query=workflow%3A\"Windows\")\n[![macOS](https://github.com/pmq20/ruby-packer/workflows/macOS/badge.svg)](https://github.com/pmq20/ruby-packer/actions?query=workflow%3A\"macOS\")\n[![Linux](https://github.com/pmq20/ruby-packer/workflows/Linux/badge.svg)](https://github.com/pmq20/ruby-packer/actions?query=workflow%3A\"Linux\")\n\n## Features\n\nIt takes less than 5 minutes to compile any project with Ruby Packer.\n\nYou won't need to modify a single line of code in your application, no matter how you developed it as long as it works in plain Ruby!\n\n- Works on ![win](resource/win_sm.png) Windows, ![macOS](resource/apple_sm.png) macOS and ![linux](resource/linux_sm.png) Linux\n- Windows is supported via the native Windows API; there are no MSYS2/MinGW/Cygwin dependencies\n- Creates a binary distribution of your Ruby and/or Rails application\n- Supports natively any form of `require` and `load`, including dynamic ones (e.g. `load(my_path + '/x.rb')`)\n- Ruby Packer is written in Ruby and is packed and distributed using Ruby Packer itself\n- Native C extensions are fully supported\n- Open Source, MIT Licensed\n\n### Known Limitations\n\n- Some gems that use C extensions that use libc IO to load files from your Rails application will not work with rubyc.  Notably, [bootsnap will not work with rubyc](https://github.com/pmq20/ruby-packer/issues/30#issuecomment-387893082)\n- On macOS and Linux, DTrace is currently disabled, see https://github.com/pmq20/ruby-packer/issues/114\n\n## Download\n\n### Stable Releases\n\nHere is the latest stable Ruby Packer release:\n\n|    OS     | Arch. |                                              Executable                                                      |\n|:---------:|:-----:|--------------------------------------------------------------------------------------------------------------|\n|  Windows  |  x64  | https://gw.alipayobjects.com/os/rmsportal/WxwlPrUTTReYNVVxJMtR.zip                                           |\n|   macOS   |  x64  | https://gw.alipayobjects.com/os/enclose-prod/b812fa0f-d52b-44f1-8233-65ab8707cf1f/rubyc-v0.4.0-darwin-x64.gz |\n|   Linux   |  x64  | https://gw.alipayobjects.com/os/enclose-prod/1fd23e6b-d48f-4ed0-94dd-f0f539960253/rubyc-v0.4.0-linux-x64.gz  |\n\n### Unstable Pre-release\n\nWhenever the `master` branch CI succeeded, a Ruby Packer pre-release binary would be automatically generated. Here is the latest unstable pre-release build:\n\n|    OS     | Arch. |                               Executable                                      |\n|:---------:|:-----:|-------------------------------------------------------------------------------|\n|  Windows  |  x64  | https://github.com/pmq20/ruby-packer/releases/download/windows-x64/rubyc.exe  |\n|   macOS   |  x64  | https://github.com/pmq20/ruby-packer/releases/download/darwin-x64/rubyc       |\n|   Linux   |  x64  | https://github.com/pmq20/ruby-packer/releases/download/linux-x64/rubyc        |\n\n## Install\n\n### ![win](resource/win_med.png) Install on Windows\n\nFirst install the prerequisites:\n\n* [Visual Studio](https://www.visualstudio.com/), all editions including the Community edition (remember to select \"Common Tools for Visual C++\" feature during installation).\n* [SquashFS Tools](http://squashfs.sourceforge.net/): you might want to first install [choco](https://chocolatey.org) and then execute `choco install squashfs`.\n* [Ruby](https://www.ruby-lang.org/): you might want to install it using [RubyInstaller](https://rubyinstaller.org/).\n* [Perl](https://www.perl.org/): you might want to install it using [Strawberry Perl for Windows](http://strawberryperl.com/).\n* [Netwide Assembler](https://www.nasm.us): please make sure `nasm` works from your command line.\n\nThen download `rubyc.exe` from either [Unstable Pre-release](#unstable-pre-release) or [Stable Releases](#stable-releases).\nOptionally, put it under `C:\\Windows` or any other `PATH` directories.\nOpen Visual Studio's \"x64 Native Tools Command Prompt\" and execute `rubyc --help` therein.\n\n### ![macOS](resource/apple_med.png) Install on macOS\n\nFirst install the prerequisites:\n\n* [SquashFS Tools](http://squashfs.sourceforge.net/): `brew install squashfs`\n* [Xcode](https://developer.apple.com/xcode/download/)\n  * You also need to install the `Command Line Tools` via Xcode. You can find\n    this under the menu `Xcode -\u003e Preferences -\u003e Downloads`\n  * This step will install `gcc` and the related toolchain containing `make`\n* [Ruby](https://www.ruby-lang.org/)\n\nThen download `rubyc` from either [Unstable Pre-release](#unstable-pre-release) or [Stable Releases](#stable-releases).\nRun `chmod +x` to give it execution permissions and execute `./rubyc --help`.\n\n### ![linux](resource/linux_med.png) Install on Linux\n\nFirst install the prerequisites:\n\n* [SquashFS Tools](http://squashfs.sourceforge.net/)\n  - `sudo yum install squashfs-tools`\n  - `sudo apt install squashfs-tools`\n* `gcc` or `clang`\n* GNU Make\n* [Ruby](https://www.ruby-lang.org/)\n\nThen download `rubyc` from either [Unstable Pre-release](#unstable-pre-release) or [Stable Releases](#stable-releases).\nRun `chmod +x` to give it execution permissions and execute `./rubyc --help`.\n\n## Usage\n\n    rubyc [OPTION]... [ENTRANCE_FILE]\n\n    ENTRANCE_FILE refers to the path of an executable ruby script from your project, e.g. \"bin/rails\".\n    If ENTRANCE_FILE was not provided, a single raw Ruby interpreter executable would be produced.\n\n    -r, --root=DIR                   The path to the root of your application\n    -o, --output=FILE                The path of the output file\n    -d, --tmpdir=DIR                 The directory for temporary files\n        --keep-tmpdir                Keeps all temporary files that were generated last time\n        --openssl-dir                The path to openssl\n        --make-args=ARGS             Extra arguments to be passed to make\n        --nmake-args=ARGS            Extra arguments to be passed to nmake\n    -i, --ignore-file=STRING         Ignore file(s) from build\n        --debug                      Enable debug mode\n        --quiet                      Enable quiet mode\n    -v, --version                    Prints the version of rubyc and exit\n    -V, --ruby-version               Prints the version of the Ruby runtime and exit\n        --ruby-api-version           Prints the version of the Ruby API and exit\n    -h, --help                       Prints this help and exit\n\n### The `--openssl-dir` Option\n\nrubyc compiles its own version of openssl without any certifications.\nTo be able to use ssl with rubyc it should know where to find the certifications.\n\nBy default this path is set to `/usr/local/etc/openssl/` but can be overridden using the `--openssl-dir` argument.\n\nKeep in mind that users running your compiled package should have their certifications\npresent in this directory as well.\n\n### The `--ignore-file` Option\n\nIf you don't want certain files included in the build you can ignore them from the command line using -i.\n\n\trubyc -i ignore.file -i ignore-2.file -i \"ignore*\"\n\nAlternatively you can create a `.rubycignore` file in the root of your project to specify which files should be ignored.\n\n## Examples\n\n### Producing a Portable Ruby Interpreter Executable\n\nI.e. packing the raw Ruby interpreter without packing any projects:\n\n\trubyc\n\t./a.out (or a.exe on Windows)\n\n### Packing a CLI utility\n\nTaking Ruby Packer itself as an example of the CLI utility to pack:\n\n\tgit clone --depth 1 https://github.com/pmq20/ruby-packer\n\tcd ruby-packer\n\trubyc bin/rubyc\n\t./a.out (or a.exe on Windows)\n\n### Packing a Rails Application\n\n\trails new yours\n\tcd yours\n\trubyc bin/rails\n\t./a.out server (or a.exe server on Windows)\n\n## Building `rubyc` from Source\n\nTo build `rubyc` you must have a C compiler and the necessary toolchain to\nbuild ruby and the libraries stuffed inside rubyc which include at least:\n* gdbm\n* libffi\n* ncurses\n* openssl\n* readline\n* yaml\n* zlib\n\nIf you are unsure if your toolchain is complete then trying to build `rubyc`\nwill let you know you are missing something.  Unfortunately it may tell you\nwith some unfamiliar message.  Please file an issue here if this occurs.\n\nOnce your toolchain is set up run `bundle`.  To compile your own `rubyc` run:\n\n\tbundle exec rake rubyc\n\nOr (if you want to compile with debug symbols):\n\n\tENCLOSE_IO_RUBYC_ADDTIONAL_ARGS=--debug bundle exec rake rubyc\n\nThis will produce a single `rubyc` executable, which can\nbe put inside any of your `PATH` locations, so that it can be directly\ncalled from the command prompt. For example:\n\n\tmv rubyc /usr/local/bin\n\nRemember that rubyc includes all the files from the current directory in the\nbuilt executable.  You must *delete the prior rubyc* or your squashfs will\n*continually grow larger* and the embedded squashfs *compile time will be\nvery, very long*.\n\n## Authors\n\n[Minqi Pan et al.](https://raw.githubusercontent.com/pmq20/ruby-packer/master/AUTHORS)\n\n## License\n\n[MIT](https://raw.githubusercontent.com/pmq20/ruby-packer/master/LICENSE)\n\n## See Also\n\n- [RubyConf 2017 (New Orleans, LA) presentation video: Packing your Ruby application into a single executable](https://www.youtube.com/watch?v=1mme7HiLqzA).\n- [Libsquash](https://github.com/pmq20/libsquash): portable, user-land SquashFS that can be easily linked and embedded within your application.\n- [Squashfs Tools](https://github.com/plougher/squashfs-tools): tools to create and extract Squashfs filesystems.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmq20%2Fruby-packer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpmq20%2Fruby-packer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmq20%2Fruby-packer/lists"}