Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby: TMPDIR=/tmp cannot hold executables

Tags:

ruby

rbenv

I am trying to install Ruby on a remote server using rbenv.

However, when I run the command rbenv install 2.7.2, I get the error below:

ruby-build: TMPDIR=/tmp cannot hold executables (partition possibly mounted with noexec)

I have rbenv and other dependencies for the Ruby programming language properly installed.

like image 404
Promise Preston Avatar asked Jun 15 '26 13:06

Promise Preston


1 Answers

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)

like image 83
Promise Preston Avatar answered Jun 17 '26 02:06

Promise Preston