1
0
Fork 0
mirror of https://github.com/mruby/mruby.git synced 2026-12-03 15:44:52 +00:00
Lightweight Ruby
  • C 60.8%
  • Ruby 36.5%
  • C++ 2.6%
Find a file
Yukihiro "Matz" Matsumoto f601369b9a
mruby-io: fork the program for IO.popen("-") again
The move to the HAL ports left "-" unspawned: the parent got a pipe whose
write end it held itself, so a read never ended. Fork through a new
mrb_hal_io_fork_process(); Windows raises NotImplementedError. Kernel#`
takes "-" as a command name, as CRuby does, and raises IOError.

Closes #7913

Co-authored-by: Claude <noreply@anthropic.com>
2026-12-03 10:01:49 +09:00
.github build(deps): bump the github-actions-dependencies group with 3 updates 2026-12-01 15:20:51 +00:00
benchmark benchmark: write the Church numeral for 100 as ten applied to ten 2026-09-09 19:36:35 +09:00
build_config mruby-encoding-transcode: String#encode and the encoding errors 2026-11-16 16:55:39 +09:00
doc Merge master. 2026-12-02 13:21:03 +09:00
examples/mrbgems mruby.h: include mruby/presym.h for all source files 2026-03-09 16:50:58 +09:00
include mruby-bigint: let the GC free temporaries a raise abandons 2026-12-02 14:13:27 +09:00
lib/mruby amalgam: keep a gem's static renames across its sources 2026-11-11 13:57:01 +09:00
mrbgems mruby-io: fork the program for IO.popen("-") again 2026-12-03 10:01:49 +09:00
mrblib Range: step a range of symbols by their names, as String#upto 2026-11-10 13:26:49 +09:00
oss-fuzz Run prek; remove trailing whitespace; cleanup markdown 2026-05-10 14:56:53 +10:00
scripts pre-commit: add hook to ensure Makefiles are indented with tabs 2025-12-30 03:30:04 +10:00
src mruby-bigint: let the GC free temporaries a raise abandons 2026-12-02 14:13:27 +09:00
tasks Keep the exception rooted while the initialized gems are finalized 2026-09-30 06:57:35 +02:00
test gc.c: compute the incremental step budget without int overflow 2026-12-02 14:13:26 +09:00
tools unicode: fetch emoji-data.txt with the character database 2026-09-26 19:17:49 +09:00
.clangd mruby-compiler: compile the generated Prism sources from the build tree 2026-10-29 10:47:14 +09:00
.codespellrc mruby-regexp: generate the general category and emoji property table 2026-09-26 19:18:20 +09:00
.dockerignore Clean up the .dockerignore file 2024-04-21 22:46:19 +10:00
.editorconfig Clean up the .editorconfig file 2024-03-12 08:41:33 +10:00
.git-blame-ignore-revs .git-blame-ignore-revs: ignore indentation fix commit; ref #6470 2025-01-22 14:10:30 +09:00
.gitattributes version.c: define MRUBY_REVISION from the source repository 2026-08-26 02:13:23 +09:00
.gitignore clangd: read the tree without a compile_commands.json 2026-08-27 15:58:57 +09:00
.gitmodules build: make Prism the default compiler, keep lrama as an option 2026-06-22 13:41:19 +09:00
.pre-commit-config.yaml build(deps): bump https://github.com/igorshubovych/markdownlint-cli 2026-11-30 14:55:07 +00:00
.prettierignore .prettierignore: exclude the vendored Prism submodule 2026-08-03 23:35:39 +09:00
.prettierrc [CI] Add prettier to pre-commit 2024-11-20 14:51:11 +10:00
.revision version.c: define MRUBY_REVISION from the source repository 2026-08-26 02:13:23 +09:00
.travis.yml Adding a serialized test task 2024-11-16 21:21:51 +09:00
.yardopts .yardopts add LEGAL, NEWS, TODO.md 2022-12-30 14:05:16 +10:00
appveyor.yml appveyor: quote the build folder in the clone script 2026-09-01 19:03:07 +09:00
AUTHORS AUTHORS: update entries [ci skip] 2026-09-01 17:54:13 +09:00
build_config.rb Move build_config.rb -> build_config/default.rb; ref #5098 2020-10-29 11:49:05 +09:00
compile_flags.txt clangd: read the tree without a compile_commands.json 2026-08-27 15:58:57 +09:00
CONTRIBUTING.md numeric.c: convert with Integer.__ensure() instead of Kernel#__to_int 2026-08-09 18:16:05 +09:00
docker-compose.yml Adding a serialized test task 2024-11-16 21:21:51 +09:00
Dockerfile super-linter: validate the Dockerfile with hadolint 2024-03-12 04:40:27 +10:00
Doxyfile Update version to 4.1.0RC. 2026-09-04 11:36:57 +09:00
Gemfile Add Docker to build and run all mruby tests 2023-04-13 00:12:32 +10:00
Gemfile.lock build(deps): bump yard in the bundler-dependencies group 2026-07-22 14:53:54 +00:00
LEGAL readfloat.c: new implementation of mrb_read_float(); ref #6187 2024-09-21 02:47:42 +09:00
LICENSE LICENSE: remove the end date of copyright notice; close #6080 2023-10-23 15:31:34 +09:00
Makefile update documentation and Makefile for prek migration 2026-02-10 14:45:22 +09:00
minirake Fix shebang by removing whitespace 2021-06-17 10:26:38 +10:00
mruby-source.gemspec Including header files in include/* by <> 2024-03-26 13:59:59 +09:00
NEWS.md Update version to 4.1.0RC2. 2026-09-11 17:19:01 +09:00
Rakefile build: log where every define came from as a build starts 2026-09-02 12:02:00 +09:00
README.md Update version and release date. (mruby 4.1.0 (2026-12-02)) 2026-12-02 11:50:19 +09:00
SECURITY.md SECURITY.md: recommend GitHub private vulnerability reporting 2026-06-17 15:52:03 +09:00
TODO.md TODO.md: remove amalgamation (implemented) 2026-01-02 16:58:39 +09:00

The mruby programming language

mruby

GitHub Super-Linter

Table of contents

What is mruby

mruby is the lightweight implementation of the Ruby language complying to (part of) the ISO standard with more recent features provided by Ruby 4.x. Also, its syntax is Ruby 4.x compatible.

You can link and embed mruby within your application. The "mruby" interpreter program and the interactive "mirb" shell are provided as examples. You can also compile Ruby programs into compiled byte code using the "mrbc" compiler. All these tools are located in the "bin" directory. "mrbc" can also generate compiled byte code in a C source file. See the "mrbtest" program under the "test" directory for an example.

This achievement was sponsored by the Regional Innovation Creation R&D Programs of the Ministry of Economy, Trade and Industry of Japan.

How to get mruby

To get mruby, you can download a release from the official mruby GitHub repository or clone the trunk of the mruby source tree with the "git clone" command. You can also install and compile mruby using ruby-install, ruby-build, rvm, conda or Homebrew.

Releases, including release candidates, are published on the releases page: https://github.com/mruby/mruby/releases. Download the mruby-<version>.tar.gz, .tar.xz or .zip attached to a release. The "Source code" archives GitHub generates for a tag, and the ZIP of the master branch, leave out the Prism parser that mruby-compiler carries as a git submodule, so they do not build.

The trunk of the mruby source tree can be checked out with the following command; the --recursive fetches that submodule as well:

$ git clone --recursive https://github.com/mruby/mruby.git

In a clone made without it, rake fetches the submodule on the first build.

mruby homepage

The URL of the mruby homepage is: https://mruby.org.

Mailing list

We don't have a mailing list, but you can use GitHub issues.

How to compile, test, and install (mruby and gems)

For the simplest case, type

rake all test

See the compile.md file for the detail.

Amalgamation (single-file build)

mruby supports amalgamation, which combines all source files into a single mruby.c and mruby.h for easy embedding (similar to SQLite).

rake amalgam

Output files are generated in build/host/amalgam/. To use:

gcc -I./build/host/amalgam your_app.c ./build/host/amalgam/mruby.c -o your_app -lm

Building documentation

There are two sets of documentation in mruby: the mruby API (generated by YARD) and C API (Doxygen and Graphviz)

To build both of them, simply go

rake doc

You can also view them in your browser

rake view_api
rake view_capi

How to customize mruby (mrbgems)

mruby contains a package manager called "mrbgems" that you can use to create extensions in C and/or Ruby. For a guide on how to use mrbgems, consult the mrbgems.md file, and for example code, refer to the examples/mrbgems/ folder.

Index of Document

License

mruby is released under the MIT License.

Note for License

mruby has chosen a MIT License due to its permissive license allowing developers to target various environments such as embedded systems. However, the license requires the display of the copyright notice and license information in manuals for instance. Doing so for big projects can be complicated or troublesome. This is why mruby has decided to display "mruby developers" as the copyright name to make it simple conventionally. In the future, mruby might ask you to distribute your new code (that you will commit,) under the MIT License as a member of "mruby developers" but contributors will keep their copyright. (We did not intend for contributors to transfer or waive their copyrights, actual copyright holder name (contributors) will be listed in the AUTHORS file.)

Please ask us if you want to distribute your code under another license.

How to Contribute

To contribute to mruby, please refer to the contribution guidelines and send a pull request to the mruby GitHub repository. By contributing, you grant non-exclusive rights to your code under the MIT License.

Contributors

mruby Contributors