1

Following the instructions here, and everything works fine manually. However, when I use the instructions in a bash script, I get rbenv command not found because the source ~/.bashrc didn't execute correctly. What's going on? Feel like I've run into this before on something else...

*Execute bit is set, ran dos2unix, and have #!/bin/bash at the top.

#!/bin/bash

git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
rbenv install 2.3.1
0

1 Answer 1

0

That’s because the script subshell doesn‘t run interactively, in which case the ~/.bashrc is set to do nothing by default. You can either use any of the workarounds explained in this and this answer or simply call rbenv with the full path on the last line:

$HOME/.rbenv/bin/rbenv install 2.3.1

Note that for Cosmic onwards there’s an rbenv package in the repositories.

0

Not the answer you're looking for? Browse other questions tagged .