Releases: igravious/cosmoruby
CosmoRuby v1.3.0 - Fat binaries, 6-platform CI, Mexican Toaster lifecycle
CosmoRuby v1.3.0 — Fat binaries, 6-platform CI, Mexican Toaster lifecycle
Ruby
- Ruby 4.0.0 x86_64-cosmo
- 5440 stdlib files embedded in /zip/
- IRB 1.16.0
Binaries
| Binary | Size |
|---|---|
| ruby.com | 29MB |
| irb.com | 29MB |
Platforms tested (CI)
- Linux x86_64 + aarch64
- macOS x86_64 + Apple Silicon
- Windows x86_64 + arm64
Changes since v1.2.3
- bb4ce7f Trigger ruby-platforms.yml CI run
- d5ccbb7 Trigger cosmo-hello-world.yml CI run
- 4b19755 Trigger cosmo-hello-world.yml CI run
- fbf0909 Trigger cosmo-hello-world.yml CI run
- b886c10 Update CI triggers for bake/releases paths, add redbean Ruby test
- 87dc487 Fix Makefile include ordering, local-includes.mk, bake output path
- 6d17e3f Refactor Ruby packaging into assemble_stdlib.sh + embed_stdlib.sh
- 68e89fb Add Mexican Toaster caboose lifecycle (thaw/persist/freeze/discard)
- cd53bb6 Add tomlc99 TOML parser library
- c086fd4 Guard YJIT init to Linux only, add ruby CI trigger script
- 5856ea0 Make encoding_utf8 CI check a soft warning
- 615a146 Rework ruby CI to download pre-built binary from release
CosmoRuby v1.2.2 - Windows YJIT Fix
Bug Fixes
- Disable YJIT on Windows (Rust TLS incompatible with Cosmopolitan)
- Ruby now executes code correctly on Windows
Technical Details
YJIT's Rust code uses std::thread::local which crashes on Windows under Cosmopolitan. The fix skips YJIT initialization when IsWindows() returns true.
Ruby works correctly without YJIT - it's a performance optimisation, not a correctness requirement.
🤖 Generated with Claude Code
CosmoRuby v1.2.1 - Windows Memory Warning Fix
Bug Fixes
- Fix mimalloc "unable to free OS memory" warning on Windows
- Windows VirtualFree can't do partial frees, now properly detected
Previous in v1.2.0
- Fix APE binary generation (MZ header at offset 0)
Usage
curl -LO https://github.com/igravious/cosmoruby/releases/download/v1.2.1/ruby.com
./ruby.com --versionCosmoRuby v1.2.0 - Allocator Info & Benchmarks
New Features
--cosmo-infoflag - Shows detailed Cosmopolitan build information- Version string - Shows
+MIMALLOCor+DLMALLOCin--versionoutput RUBY_COSMO_ALLOCATORconstant - Runtime allocator detection from Ruby code
Benchmark Suite
New performance regression tests in performance_regressions/:
memory_allocator_benchmark.rb- RSS growth testing (1M Class.new)class_new_benchmark.rb- Allocation speed testingyjit_benchmark.rb- JIT performance testing
Performance Results (1M Class.new allocations)
| Allocator | RSS Growth | Time | Status |
|---|---|---|---|
| System Ruby (glibc) | 1.21x | 14.3s | Best overall |
| mimalloc | 1.59x | 26.8s | ✓ Recommended |
| dlmalloc (no rseq) | 1.60x | 33.2s | ✓ Stable |
| dlmalloc (default) | 8.80x | 49.8s | ✗ Memory retention |
Key Findings
- Pure computation matches system Ruby - 0.48s vs 0.47s for 10M iterations
- Allocation overhead - The ~2x slowdown is entirely in malloc/GC path, not Ruby interpreter
- mimalloc recommended - Stable memory, fastest CosmoRuby option
- dlmalloc RSEQ issue - Disable with
COSMOPOLITAN_M_RSEQ_MAX=0if using dlmalloc
Usage
```bash
Check allocator in version
ruby.com --version
ruby 4.0.0 (2025-12-31) +PRISM +MIMALLOC [x86_64-cosmo]
Detailed build info
ruby.com --cosmo-info
Runtime check
ruby.com -e 'puts RUBY_COSMO_ALLOCATOR'
mimalloc
```
CosmoRuby 4.0.0 v1.0.0
CosmoRuby 4.0.0 v1.0.0
The first stable release of Ruby 4.0.0 for Cosmopolitan Libc.
Downloads
| File | Description |
|---|---|
ruby.com |
Ruby interpreter with embedded stdlib (~15MB) |
irb.com |
Interactive Ruby shell with embedded stdlib |
Features
- Actually Portable Executable: Single binary runs on Linux, macOS, Windows, FreeBSD, OpenBSD, NetBSD
- Embedded stdlib: No external dependencies, no RUBYLIB needed
- Full Ruby 4.0.0: Prism parser, YJIT JIT compiler, all core features
- Bundled tools: gem, bundle, rake, irb, rdoc, ri, erb, racc, typeprof, test-unit
Usage
# Download and make executable
chmod +x ruby.com
# Run Ruby code
./ruby.com -e 'puts "Hello from Ruby #{RUBY_VERSION}!"'
# Run scripts
./ruby.com script.rb
# Interactive shell
./irb.com
# Run bundled tools
./ruby.com -S gem --version
./ruby.com -S rake --versionExtensions
Built-in extensions (statically linked):
- date, digest, etc, fcntl, io/console, io/nonblock, io/wait
- json, openssl (via mbedtls), psych (YAML), stringio, strscan, zlib
- socket, ripper, coverage, objspace
What's New in This Release
- Fixed undefined behaviour issues when running with ubsan
- Improved debugging with mimalloc backtrace support
- Fixed
ruby -Sto use embedded scripts instead of system PATH - Fixed
RbConfig.rubyto return actual executable path - Added racc, typeprof, test-unit to bundled executables
Known Limitations
- No C extension compilation (extensions must be statically linked)
- Windows console input may have quirks in IRB
- YJIT requires x86_64 architecture
Building from Source
git clone https://github.com/user/cosmopolitan
cd cosmopolitan
git checkout feature/ruby-4.0.0-port
make -j8 o//third_party/ruby/ruby
cd third_party/ruby && ./package_ruby.sh
# Output: o/third_party/ruby/ruby.comChangelog
Full commit: decd350383 - Ruby 4.0.0: Polish for v1 release
Ubsan/undefined behaviour fixes
- Disable UNALIGNED_WORD_ACCESS when ubsan enabled
- Fix signed left shift UB in prism_compile.h
- Add #ifndef guards in st.h to prevent macro redefinition
Packaged mode improvements
- Fix ruby -S to search /zip/bin only, preventing rbenv/system ruby conflicts
- Add RUBY_COSMO_EXECUTABLE constant with actual executable path
- Fix RbConfig.ruby to return real path instead of /zip/bin/ruby.com
- Add racc, typeprof, test-unit executables to packaged bin/
mimalloc debugging enhancements
- Add symbolic backtrace on invalid pointer errors
- Add backtrace on assertion failures in debug builds
- Register ShowBacktrace from Ruby for richer debug output
Build system
- Add THIRD_PARTY_MIMALLOC dependency for ruby, irb, miniruby
- Simplify YJIT Cargo build rules
Ruby cross-platform test
Pre-built ruby.com for CI testing
Mexican Toaster test
Fat APE binaries (mtsh.com, lsdir.com, caboose.com) for cross-platform CI testing
Phase 0 hello test
APE fat binary for cross-platform testing
Fat APE smoke test
APE fat binary for cross-platform testing
Caboose cross-platform test
Fat APE caboose.com binary with embedded ZIP filesystem for cross-platform CI testing