I've spent a couple days trying to understand how to use mise with Ruby and RoR. I have to admit I'm lost!
This was on a bare bones new Ubuntu server. I finally got ruby 3.2 installed after many tries at this and that. I could get mise use --global ruby to create a new ruby version. I could get mise use -- ruby -v got print the version. But nowhere can I find on how to use it with Rails.
Can't use it to install the Rails gem or do anything but display the version number!
I know I'm missing a lot but until there is some use documentation, I'll stick with rbenv. I'm in no hurry. old stuff works!
Hey there, I’m Silviu – your friendly backend developer from Brașov, Romania. Over the past 7 years, I’ve been busy turning quirky web ideas into rock‑solid, scalable systems.
I tried Mise because DHH uses it, and it's nice since you can install multiple languages with it. In omakub, you can find a script on how to use it, but for me, the official documentation was good enough. Mise is still a relatively new version manager, and its documentation can be sparse.
1. Ensure Mise is Activating the Correct Ruby
Run:
mise exec-- ruby -v
This ensures that Ruby is being executed through Mise. If the version doesn’t match what you expect, try:
mise reshim
This regenerates the shims to properly point to the installed binaries.
2. Install Bundler and Rails with Mise's Ruby
Since Mise manages versions but not gems directly, you need to install Bundler and Rails inside the version of Ruby that Mise is using:
mise exec-- gem install bundler
mise exec-- gem install rails
mise reshim # Important after installing gems with binaries
3. Check if Rails is Available
Try running:
mise exec-- rails -v
If that works, then your Rails installation is functioning properly.
4. Global vs Local Environment Setup
Global Installation
If you want Rails available globally, install it in the global Ruby environment:
mise use --global ruby@3.2
mise exec-- gem install rails
mise reshim
Per-Project Setup
If you prefer a per-project setup, use a .tool-versions file in your project directory:
echo"ruby 3.2"> .tool-versions
mise install
mise exec-- gem install rails
mise reshim
5. Ensure Shell is Set Up Correctly
If you’re having trouble, check your shell configuration to ensure Mise is initialized properly. Add this to ~/.bashrc or ~/.zshrc:
eval"$(mise activate)"
Then restart your terminal or run:
source ~/.bashrc # or source ~/.zshrc
If these steps still don’t work, I totally get sticking with rbenv if it works for you—Mise is still growing.
Hey there, I’m Silviu – your friendly backend developer from Brașov, Romania. Over the past 7 years, I’ve been busy turning quirky web ideas into rock‑solid, scalable systems.
I've spent a couple days trying to understand how to use mise with Ruby and RoR. I have to admit I'm lost!
This was on a bare bones new Ubuntu server. I finally got ruby 3.2 installed after many tries at this and that. I could get
mise use --global ruby
to create a new ruby version. I could getmise use -- ruby -v
got print the version. But nowhere can I find on how to use it with Rails.Can't use it to install the Rails gem or do anything but display the version number!
I know I'm missing a lot but until there is some
use
documentation, I'll stick with rbenv. I'm in no hurry. old stuff works!I tried Mise because DHH uses it, and it's nice since you can install multiple languages with it. In omakub, you can find a script on how to use it, but for me, the official documentation was good enough. Mise is still a relatively new version manager, and its documentation can be sparse.
1. Ensure Mise is Activating the Correct Ruby
Run:
This ensures that Ruby is being executed through Mise. If the version doesn’t match what you expect, try:
This regenerates the shims to properly point to the installed binaries.
2. Install Bundler and Rails with Mise's Ruby
Since Mise manages versions but not gems directly, you need to install Bundler and Rails inside the version of Ruby that Mise is using:
3. Check if Rails is Available
Try running:
If that works, then your Rails installation is functioning properly.
4. Global vs Local Environment Setup
Global Installation
If you want Rails available globally, install it in the global Ruby environment:
Per-Project Setup
If you prefer a per-project setup, use a
.tool-versions
file in your project directory:5. Ensure Shell is Set Up Correctly
If you’re having trouble, check your shell configuration to ensure Mise is initialized properly. Add this to
~/.bashrc
or~/.zshrc
:Then restart your terminal or run:
If these steps still don’t work, I totally get sticking with rbenv if it works for you—Mise is still growing.
I finally found a good article on how to use mise with rails. Damn if I can find it!
It came down to putting
eval "$(~/.local/bin/mise activate)"
in my .bashrc file. About the same as you suggested.
Nice, good job! 😄 ㊗️