After a few research and trials, I was able to solve it.
Here's how I solved it:
The issue was that the rbenv installer needed a directory to store temporary files while it is downloading and installing ruby, however, the /tmp
directory which is the default directory for storing temporary files wasn't accessible by my current user.
I tried to change permissions for the /tmp
directory to allow it become accessible to my current user, however, I was unsuccessful.
All I had to do was to create a new tmp
directory in the home directory of my user:
mkdir ~/tmp
Next, I opened the .bashrc
file in the home directory of my user:
sudo nano ~/.bashrc
Next, I added the line below to the bottom of the file and saved:
export TMPDIR="$HOME/tmp"
Finally, I restarted my terminal or ran the command below to load the newly added paths into my current shell/terminal session:
exec "$SHELL"
Now, I could run the command rbenv install 2.7.2
and it worked fine.
Resources: TMPDIR=/tmp cannot hold executables (partition possibly mounted with noexec
)