Rubish: A Unix shell written in pure Ruby

https://news.ycombinator.com/rss Hits: 16
Summary

A UNIX shell written in pure Ruby. Shell syntax is parsed and compiled to Ruby code, then executed by the Ruby VM. Rubish supports all the features of bash, and the shell syntax is fully compatible. You can run your existing bash scripts without modification. If you found any bash script that doesn't work in rubish, we consider it a bug, so please report it! Rubish is not just a shell implemented in Ruby, but a shell that deeply integrates Ruby. You can seamlessly mix shell commands and Ruby code, and even use Ruby's powerful features like blocks, iterators, and libraries in your shell scripts. brew tap amatsuda/rubish brew install --HEAD rubish git clone https://github.com/amatsuda/rubish.git cd rubish bundle install bundle exec exe/rubish bin/rubish is a small bash launcher that finds a usable Ruby on its own (probes ~/.rbenv/shims/ruby, /opt/homebrew/bin/ruby, /usr/local/bin/ruby, system Ruby; honors $RUBY). Use it when bundler isn't around — for example as a login shell, from a .app bundle, or anywhere PATH may be minimal: ./bin/rubish RUBY=/opt/homebrew/opt/ruby@3.4/bin/ruby ./bin/rubish # explicit override Start an interactive shell: Run a single command: Run a script: Or you can even use this as a login shell! echo "$(which rubish)" | sudo tee -a /etc/shells chsh -s "$(which rubish)" Use Ruby expressions as conditions in if, while, and until by wrapping them in { }. Shell variables are automatically bound as local variables in the Ruby expression: COUNT=5 if { count.to_i > 3 } echo 'count is greater than 3' end while { count.to_i > 0 } echo $COUNT COUNT=$((COUNT - 1)) done Commands can be invoked using Ruby method call syntax with parentheses, in addition to the traditional UNIX style with spaces: # These are equivalent: ls -la ls('-la') # Arguments can be passed as method arguments: cat(file.txt) grep('pattern', file.txt) Commands can be chained with Ruby methods using dot notation, forming a pipeline. The chain has to be opened by a parenthesized call, an a...

First seen: 2026-05-23 09:33

Last seen: 2026-05-24 00:46