Installation
This guide will help you install T-Ruby on your system. T-Ruby requires Ruby 3.0 or later.
Prerequisites
Before installing T-Ruby, make sure you have:
- Ruby 3.0+ installed (ruby-lang.org)
- RubyGems (comes with Ruby)
- A terminal/command prompt
To verify your Ruby installation:
ruby --version
# Should output: ruby 3.x.x ...
Install via RubyGems
The easiest way to install T-Ruby is via RubyGems:
gem install t-ruby
This installs the trc compiler globally on your system.
Verify the installation:
trc --version
# Should output: trc x.x.x
Install via Bundler
For project-specific installation, add T-Ruby to your Gemfile:
group :development do
gem 't-ruby'
end
Then run:
bundle install
Use bundle exec trc to run the compiler:
bundle exec trc --version
Install from Source
For the latest development version:
git clone https://github.com/type-ruby/t-ruby.git
cd t-ruby
bundle install
rake install
Verify Installation
After installation, verify everything works:
# Check version
trc --version
# Show help
trc --help
# Create a test file
echo 'def greet(name: String): String; "Hello, #{name}!"; end' > test.trb
# Compile it
trc test.trb
# Check the output
cat build/test.rb
Updating T-Ruby
To update to the latest version:
gem update t-ruby
Uninstalling
To remove T-Ruby:
gem uninstall t-ruby
Troubleshooting
"Command not found: trc"
The gem binary path might not be in your PATH. Find it with:
gem environment | grep "EXECUTABLE DIRECTORY"
Add the directory to your shell's PATH.
Permission errors on Linux/macOS
If you get permission errors, either:
- Use a Ruby version manager (rbenv, rvm)
- Use
sudo gem install t-ruby(not recommended) - Configure gem to install to your home directory
Build errors
If compilation fails, ensure you have development tools installed:
# macOS
xcode-select --install
# Ubuntu/Debian
sudo apt-get install build-essential
# Fedora
sudo dnf groupinstall "Development Tools"
Next Steps
Now that T-Ruby is installed, let's write some code:
- Quick Start - Get running in 5 minutes
- Understanding .trb Files - A detailed walkthrough
- Editor Setup - Configure your IDE