Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a persistent call to the current RVM Ruby by Alias

Tags:

ruby

shebang

rvm

The ruby shebang in several of my scripts is the usual system (MacOS) /usr/bin/ruby. I use RVM for my rubies, so it's often different than the system install of ruby.

Is there a way for a shebang to contain a reference or alias of some sort, so that it always points to the current RVM chosen installation?

like image 222
Rich_F Avatar asked Nov 30 '25 16:11

Rich_F


1 Answers

Use:

#!/usr/bin/env ruby

This tells the shell to look up the Ruby in the $PATH which will be the correct one managed by RVM in most cases if you use RVM.

like image 144
DiegoSalazar Avatar answered Dec 02 '25 07:12

DiegoSalazar