[ACCEPTED]-Cannot install RVM . Permission denied in /usr/local/rvm-rvm
mkdir: cannot create directory `/usr/local/rvm': Permission 3 denied
If you've run the rvm installer as 2 root previously, remove /usr/local/rvm and 1 /etc/rvmrc.
RVM is easy to install, but you are making 73 it harder by trying to mix and match installation 72 types. You do NOT need to create a new user. When 71 run, RVM will create a directory in your 70 home directory: ~/.rvm
, and install everything 69 inside it. That means you will have all 68 the correct permissions. You do NOT need 67 to be running as root, you do NOT need to 66 use sudo. I'd recommend closing all your 65 command-lines and open one fresh and start 64 at your home directory. If you are running 63 as root, log out, and log back in to your 62 normal account. For a single-user install 61 you do NOT need to be root.
For a single 60 user, using RVM as their Ruby sandbox, use 59 the single-user installation docs. Follow ALL the instructions on that page, INCLUDING the 58 "Post Install" section.
Close your 57 terminal window, and reopen it. If you have 56 correctly followed the instructions above, typing 55 rvm info
should spit out a template of what is to 54 come once you install a Ruby instance. If 53 you see nothing output, or get an error, then 52 retrace your steps in the "Post Install" section, and 51 go through the "Troubleshooting" section. Most 50 of the problems people have occur because 49 they didn't bother to read the directions.
Once 48 RVM is installed, type rvm notes
and read what dependencies 47 you need to install. If you do not add those 46 files your Rubies installed will be missing 45 functionality. They will work, but some 44 of the creature comforts you'll hear about 43 won't work and you will wonder why.
After 42 installing the dependencies you should be 41 in good shape to install Rubies. Type rvm list known
for 40 all the Rubies RVM can install. If you want 39 1.8.7 type rvm install 1.8.7
, and, similarly, rvm install 1.9.2
for Ruby 1.9.2. If 38 you want a particular revision you can add 37 that, based on the ones in the list.
It's 36 important to periodically update RVM using 35 rvm get head
. That will add features, fix bugs, and 34 tell RVM about new versions of Ruby it can 33 install if you request.
After installing 32 a Ruby, type rvm list
and it should show up in the 31 list, looking something like this:
rvm rubies ruby-1.8.7-p334 [ x86_64 ] ruby-1.9.2-p180 [ x86_64 ]
Type rvm use 1.9.2 --default
to 30 set a default Ruby that will be sticky between 29 logins. Use the version of whatever Ruby 28 you want to default to if 1.9.2 doesn't 27 float your boat. Once you've defined a default 26 it should look something like:
rvm rubies ruby-1.8.7-p334 [ x86_64 ] => ruby-1.9.2-p180 [ x86_64 ]
Before you 25 begin installing gems into a RVM-managed 24 Ruby, read "RVM and RubyGems ", in particular the part that 23 says "DO NOT use sudo... ". I 22 repeat. Do NOT use sudo to install any gems, in 21 spite of what some blog or web page says. RVM's 20 author knows better when it comes to working 19 with RVM controlled Rubies. That is another 18 mistake people use with RVM, again as a 17 result of not reading the directions.
On 16 Mac OS, you'll need the latest version of 15 XCode for your OS. Do NOT use the XCode 14 that came with Snow Leopard on the DVD. It 13 is buggy. Download and install a new version 12 from Apple's Developer site. It's a free download requiring a 11 free registration. It's a big file, approximately 10 8GB, so you'll want to start it and walk 9 away. Install XCode, and you should be ready 8 to have RVM install Rubies.
Finally, RVM 7 installs easily, as will the Rubies you 6 ask it to install. I have it on about four 5 or five different machines and VMs on Mac 4 OS, Ubuntu and CentOS. It takes me about 3 a minute to install it and another minute 2 to configure it and start installing a new 1 Ruby. It really is that easy.
I had the original issue reported in this 29 question, "mkdir: cannot create directory `/usr/local/rvm': Permission denied" when trying to install rvm.
This 28 is my scenario and how I solved it - maybe 27 this will help others with this same issue.
I 26 have Ubuntu 11.04 installed on a laptop, I 25 only have 1 user, the one I created at install 24 time, named nathan. When I would try to 23 install rvm as nathan, the rvm installer 22 saw me as root and kept trying to install 21 rvm globally, but since I wasn't really 20 root, it couldn't get access to create directories 19 in /usr/local/rvm.
I'm far from an expert 18 with Ubuntu, so I'm sure there are easier/better 17 ways to accomplish the things I did (and 16 I would love to learn about them), but this 15 worked for me:
- I created a new user called rubydev
I logged in as rubydev, opened 14 a terminal and typed:
rubydev~$ bash < <(curl -B http://rvm.beginrescueend.com/install/rvm)
rvm installed correctly 13 and I logged out of rubydev
- Signed back in as nathan, opened a terminal and typed "su" (you could do all this with sudo, I am lazy)
After successfully 12 getting root, I typed the following commands:
root: /home/nathan# cp -R /home/rubydev/.rvm . root: /home/nathan# chown -R nathan .rvm root: /home/nathan# chgrp -R nathan .rvm root: /home/nathan# exit nathan~$ echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile nathan~$ echo 'export rvm_path="/home/nathan/.rvm"' > ~/.rvmrc nathan~$ source .bash_profile
At 11 this point, rvm was correctly installed 10 under my home directory. To verify I typed:
nathan~$ type rvm | head -1 rvm is a function (if you don't get this response, something else is wrong)
Read 9 the notes and installed any dependencies
nathan~$ rvm notes
I 8 installed some rubies
nathan~$ rvm install 1.8.7-head nathan~$ rvm install 1.9.2-head
Verified install
nathan~$ rvm list rvm rubies ruby-1.8.7-head [x86_64] ruby-1.9.2-head [x86_64] nathan~$ rvm use 1.9.2 using /home/nathan/.rvm/gems/ruby-1.9.2-head nathan~$ rvm list rvm rubies ruby-1.8.7-head [x86_x64] => ruby-1.9.2-head [x86_x64]
Finally, I 7 edited the preferences on the terminal itself 6 to ensure the "Run command as as login shell" under 5 the "Title and Command" tab was checked. It 4 seems .bash_profile isn't otherwise processed.
I 3 removed the rubydev user I created in step 2 1.
With all of that, I have a working rvm 1 under Ubuntu 11.04 using my preferred username.
I solved this by adding
export rvm_path=~/.rvm
to ~/.bash_profile
0
If you first installed RVM as root and then 5 uninstalled it. And now you are trying to 4 install it as a non sudo user and you're 3 getting the following error:
mkdir: cannot create directory `/usr/local/rvm': Permission denied
Make sure that 2 you have logged out of the root session 1 before trying to install under the user.
If you installing RVM as a user then the 14 RVM folder should be generated in your home 13 directory:
~/.rvm
Where there should be no permissions 12 problems at all.
I would suggest it is picking 11 up some old config that is left over from 10 your system installation.
Ensure there is 9 no /etc/rvmrc or $HOME/.rvmrc file left 8 over because it might be using previously 7 initialised variables from these files to 6 construct an incorrect installation path.
if 5 we look at this section of the bash script:
if [[ ${rvm_ignore_rvmrc:-0} -eq 0 ]]; then
for file in /etc/rvmrc "$HOME/.rvmrc " ; do
if [[ -s "$file" ]] ; then
source $file
fi
done
fi
It 4 is trying to find one of these files, if 3 it finds one if will run it possibly initialising 2 rvm_path which will subsequently not be 1 set as $HOME/.rvm by this command
rvm_path="${rvm_path:-"$HOME/.rvm"}"
I had the same issue. When I tried to create 5 a gemset I would get a permission denied 4 error. I just forgot to run the "rvm use 3 1.8.7" command first. After that I was able 2 to create and use the gemset without any 1 problems.
In lasts versions of rvm you need remove 3 /etc/profile.d/ also.
This happen often if 2 you try to install as root and then try 1 again as a regular user.
Hope this help.
Look for file rvm.sh below /etc directory 4 (It may be in /etc, or /etc/init.d). Also, try 3 some grep rvm /etc -r, so you can find some 2 files/lines which prevent you from installing 1 rvm in your $HOME dir.
For me running
__rvm_unload
Worked first, this was due 2 to the fact that I had rvm installed as 1 for multiuser.
If you installed rvm as root and you are 5 getting permission denied issues (maybe 4 you are deploying with capistrano as a non 3 root user) then you could try rvm fix-permissions
after doing 2 things like rvm install 2.2.2
as root and creating a gemset 1 as root.
Scott Bartell's solution worked for me. i 7 am on a Digital Ocean premade image, where 6 they had already setup rvm as root. 1. deleted 5 /etc/rvmrc . 2. added export rvm_path=~/.rvm 4 to ~/.bash_profile 3. logged out of ssh 3 session to virtual machine 4. logged back 2 in and presto!
would have commented but rep 1 is 3 points too low :)
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.