I discovered asdf quite late! I was relying on a bunch of different programs to manage Ruby (rvm), Node (nvm).

asdf was an amazing headache saver. It already has core plugins for Elixir, Erlang, Node and Ruby. Plus, it has community plugins for what seems like practically anything under the sun.

I had installed asdf on a new system. And as usual, there were some crons to run on it. I kept getting a /bin/bash/ruby not found error.

After some time I realized I had faced this problem before as well!

I had encountered a similar problem when I was using rvm to version manage ruby. So, digging through that blog post, I realized what had to be done.

As in the other case, I had to add the following lines in my .bashrc file

. $HOME/.asdf/asdf.sh

And I had to add that before the interactive shell check.

# IMPORTANT - load sdf for non-login shells e.g. Net:SSH / cron jobs
. $HOME/.asdf/asdf.sh

# If not running interactively, don't do anything
[ -z "$PS1" ] && return