While executing this command to install rvm

curl -sSL https://get.rvm.io | bash -s stable

I am getting this error message:

mktemp: failed to create file via template ‘/usr/share/rvm/rvm-exec-test.XXXXXX’: Permission denied

The $ suggests you are attempting this install as a regular (i.e. non-root) user. If so, that is likely your problem, as the /usr/share/ tree on most Linux operating systems is writable only by root. The software you are trying to install likely wants you to have root permissions to perform the install.


I solved it by changing the following

curl -sSL https://get.rvm.io | bash -s stable


curl -sSL https://get.rvm.io | sudo bash -s stable

The user needs access to the subdir. /usr/local

  • 2
    Note - this version with "sudo" installs it as multi-user in /user/local . If you want a user-install, where the gems etc go in the user's home-directory, something else is required. Nevermind that the one that fails (reported by the OP) is what is in the horrible rvm instructions for a single-user install, which have never worked for me without hours of fiddling each and every time.
    – JosephK
    Feb 13 '18 at 7:45

You probably have (or had) a system-wide installation of RVM. That can be due installing it through a package system like apt-get on Ubuntu or pacman on Arch Linux (both have rvm packages).

Check your environment variables:

> env | grep rvm_path

If you have it, then unset it and try to install again:

> unset rvm_path
> curl -sSL https://get.rvm.io | bash -s stable

BEWARE! If you still have rvm installed system-wide, this can give you unpredictable results, make sure you have it uninstalled before doing that.

If you have it already uninstalled and rvm_path is still there, maybe you can log out and log in again to remove them from the environment (or just restart the computer).

  • thanks working for me, i install ruby previously and also recommend do this <code> unset GEM_HOME</code>
    – jonathan
    May 7 '18 at 14:54
  • This solved the problem for me!
    – Korayem
    Nov 13 '18 at 17:14

Probably you had install another version of RVM in your computer. Check, if you have Ubuntu, maybe you installed the exclusive Ubuntu version https://github.com/rvm/ubuntu_rvm You can uninstall it with command

sudo apt-get purge rvm

I resolve it like this. And then install rvm with

\curl -sSL https://get.rvm.io | bash -s stable

And then configuring the source from

source ~/.rvm/scripts/rvm

You then need yo add the source of rvm to your .bashrc and .profile files in your home

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.