Permission denied when trying to install RVM? - ruby-on-rails

I renamed my Macbook home directory to "hmumin" from "macbookpro".
I then tried to install RVM using:
$ curl -L https://get.rvm.io | bash -s
but I get an error:
mkdir: /Users/macbookpro/.rvm/src: Permission denied
Is this error from trying to install RVM in the previous home directory?
If I run:
open /Users/macbookpro
I get:
The file /Users/macbookpro does not exist.
Yet, if I run:
mkdir /Users/macbookpro
I get:
mkdir: /Users/macbookpro: Permission denied
It's pretty confusing, I just want to install RVM.
When I type RVM I also get this type of error:
cat: /Users/macbookpro/.rvm/VERSION: No such file or directory
Warning! PATH is not properly set up, '/Users/macbookpro/.rvm/gems/ruby-2.0.0- p353#railstutorial_rails_4_0/bin' is not at first place,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
to fix temporarily in this shell session run: 'rvm use ruby-2.0.0-
p353#railstutorial_rails_4_0'.
-bash: /Users/macbookpro/.rvm/scripts/base: No such file or directory
-bash: /Users/macbookpro/.rvm/scripts/help: No such file or directory
hmumin:~ hmumin$

It sounds like you have multiple problems, and they need to be addressed individually before you can successfully install RVM:
You can't rename your home directory and expect a machine to be happy. There are multiple places that track your home directory name, including the security system that maintains the user and group information. You need to check on "Ask Different" for how to correctly recover from this situation, and then how to correctly change your home directory as it is off-topic for Stack Exchange.
Carefully read the instructions for RVM installation at http://rvm.io/rvm/install. RVM is a very easy-to-install Ruby manager, however there are decisions you have to make up front, before you begin installing it. I'd strongly recommend you do the single-user installation, but, no matter which you choose, read the entire page first.

Related

'Zsh: command not found: valet' - unable to install Valet

I just tried installing valet for a very long time, - and I couldn't find any help anywhere. No matter what I tried, then it kept saying:
Zsh: command not found: valet
I'm running Zshell (instead of Bash) and OSX. I've had Brew installed for quite a while.
I'll answer this myself, - so hopefully people in the same situation can find this in the future.
I had a very similar problem under Zsh, but my solution was easier. Rather than adding ~/.composer/vendor/bin to my $PATH, I needed to use the full directory name; i.e., /Users/[your-user-name]/.composer/vendor/bin.
Everywhere it says to 'Check that your path is right'. And yup - if you haven't done that, then you should start there. The easiest way is to go to your terminal and write:
echo $PATH
... And then you should see ~/.composer/vendor/bin in between two colons in there. If that isn't there, then you should go to your ~/.bashrc-file (or ~/.zshrc-file) and add this line:
export $PATH=~/.composer/vendor/bin:$PATH
And then it may be fixed.
My problem had deeper roots, though. Even though my path was right, then I still got the error:
Zsh: command not found: valet
And if I wrote: which valet - then it (obviously) just responded with valet not found.
Removal of Composer
What fixed it was to remove all my composer-installations. Composer can be located in several different locations (and installed by brew). So in order to remove it, then do this (inspired by this post, but it lacks a couple of steps):
Remove your composer- or -composer.phar-file. You can find them by running which composer and/or which composer.phar.
Remove your .composer-folder (usually located here: ~/.composer).
Then make sure that there isn't an installation done with Homebrew (this was what I think made the collision for me). You do it by running brew unlink composer followed by brew remove composer.
Then, - if you want to be 100% sure that it's all gone, then go to your root (cd /) and run this command: find ./* -name 'composer.phar' and this find ./* -name 'composer'. That should tell you of all the locations where the Composer-installation can be installed.
When all that's removed, then you should be rid of Composer (entirely).
... Then install it again, - and see if you can get valet to work (it did for me).
The solution was adding composer bin to the path. You can use the following commands
From the terminal
export PATH="$PATH:$HOME/.composer/vendor/bin"
echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.bash_profile
source ~/.bash_profile
valet install
Issue Ubuntu: no command valet
Valet on Ubuntu:
sudo apt install libnss3-tools jq xsel
composer global require cpriego/valet-linux
.composer/vendor/cpriego/valet-linux/valet install
Now command valet should work, but if still not:
sudo cp .composer/vendor/cpriego/valet-linux/valet /usr/local/bin/

Permission Denied while trying to install ruby gems on ubuntu 16.04

I am trying to install ruby gems on my computer running Ubuntu 16.04. I use bash with the oh-my-zsh framework.
When I run the command:
curl -L https://get.rvm.io | bash -s stable --ruby
I get the error message:
mktemp: failed to create file via template '/usr/share/rvm/rvm-exec-test.XXXXXX': Permission denied
How do I set up the permissions for this to work properly?
You can use:
curl -L https://get.rvm.io | sudo bash -s stable --ruby
NOTE: Running a script as sudo can be very dangerous if you don't know what it is actually doing. Make sure to check the script and if possible give the appropriate permissions to the required files and or folders it needs to access. For some more info regarding why it can be dangerous see https://elementaryos.stackexchange.com/questions/448/why-is-running-commands-with-sudo-dangerous
Quick example with your particular use case, as can be seen in the link:
"...If a website is asking you to curl http://link/to/script | sudo bash, don't do that. Download the script, take a quick look, and after that, you can run it. Even if the original author did not intend to make the script malicious, someone might have compromised the original author's accounts and uploaded a new, "updated" script. You are the one responsible for your computer's integrity, and therefore you need to be familiar with your system's capabilities."
Make The directory as read and write ... cd dirname chmod 777
or
sudo gem install 'gem name','version'

Atom linter-erb failing with "Error: /usr/bin/env: ruby: No such file or directory"

I have the linter set to check on save and it throws this error every time I save a .erb file. In the settings for the package I have both the following settings specified:
Erb Executable Path
/home/jason/.rvm/rubies/ruby-2.3.0/bin/erb
Ruby Executable Path
/home/jason/.rvm/rubies/ruby-2.3.0/bin/ruby
I was having a similar issue with the linter-ruby package, but setting the ruby executable path seemed to fix it. Here's what my path looks like:
$ echo $PATH
/home/jason/.nvm/versions/node/v5.10.0/bin:/home/jason/.rvm/gems/ruby-2.3.0/bin:/home/jason/.rvm/gems/ruby-2.3.0#global/bin:/home/jason/.rvm/rubies/ruby-2.3.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/jason/.rvm/bin:/home/jason/.rvm/bin
Here's the full output of the error.
Error: /usr/bin/env: ruby: No such file or directory
at parameters.exit (/home/jason/.atom/packages/linter-erb/node_modules/atom-linter/lib/helpers.js:47:27)
at triggerExitCallback (/opt/atom/resources/app.asar/src/buffered-process.js:213:47)
at /opt/atom/resources/app.asar/src/buffered-process.js:220:18
at Socket.<anonymous> (/opt/atom/resources/app.asar/src/buffered-process.js:98:18)
at emitOne (events.js:82:20)
at Socket.emit (events.js:169:7)
at Pipe._onclose (net.js:469:12)
It seems even though I've specified where it should be looking for ruby, it's still looking in /usr/bin/env.
Here's a bit more output that's hopefully helpful:
$ which erb
/home/jason/.rvm/rubies/ruby-2.3.0/bin/erb
$ which ruby
/home/jason/.rvm/rubies/ruby-2.3.0/bin/ruby
I'm not sure this would have any effect, but for the sake of trying to cover all my bases, I also have this in ~/.bashrc
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
Ubuntu: 15.10
kernel: 4.2.0-34
Atom: 1.6.0
linter-erb: 1.0.2
I've restarted Atom several times but the error keeps popping up. Any help would be much appreciated.
EDIT
I found that if I start Atom from the terminal, I don't have this problem, but when I launch it from the icon in the launcher, the issue crops up again.
Try pointing the linter to RVM wrappers instead of direct binaries in RVM which work OK only in interactive shells. RVM wrappers make the binaries run correctly even in other environments and shells.
Simply choose a wrapper directory under $HOME/.rvm/wrappers/ for your desired version of ruby and gemset and use the binaries from there.
See this answer for more explanation.

Hello world on ruby and rails (ror)

I've saved 'hello world' as a .rb file on my computer running Mac OS X Lion. I'm trying to create a new directory called ruby_tutorials in the root of my file system, but I'm having some trouble.
I tried typing in the command mkdir /ruby_tutorials in a terminal, but I got this error message: 'Permission Denied'. How can I overcome this?
Try this:
sudo mkdir /ruby_tutorials
sudo allows you to execute commands as a superuser. You need administrative privileges to create a directory in your root directory. One reason to use sudo for individual commands instead of always having administrative privileges is that it protects you from accidentally harming your system.

RVM not found, after installing RVM

I've found a couple similar posts regarding this same problem, but none of the solutions seem to apply, here.
On a fresh Ubuntu 10.10 install, I follow the instructions for installing RVM:
$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
Then I create .bash_profile and add the following line:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
I restart the terminal and check RVM:
$ type rvm | head -1
-bash: type: rvm: not found
As the RVM installation guide explains to do so, I replaced the first line (below) in .bashrc with the second one, then indented everything in the rest of the file and added a fi.
[ -z "$PS1" ] && return # original
if [[ -n "$PS1" ]]; then # replaced with this
Restarted terminal and still, no luck.
Then, I removed the line I added to .bash_profile in the beginning and added it to .bashrc, even though that isn't what the guide said to do. Still, no luck. I also entered it directly on the command line, with no change in behavior. When I run .rvm from ~/.rvm/bin/rvm it complains that there is no such file or directory as /.rvm/scripts/rvm and that the command was not fund.
Of course, there isn't any such "scripts" directory inside of ./rvm, either -- so I'm not sure why it's looking for one? The only directories inside of .rvm are
archives
bin
config
gems
gemsets
log
man
rubies
src
tmp
user
The only thing I've found while googling for answers are other people complaining of similar problems and people telling them to add the instructed line to .bash_profile (which I obviously already did). At this point, I have nothing more to go on and am at an impasse.
Regards.
Resolution:
As Andrew Marshall advised in his comments, below, I did an 'rm -rf .rvm' and reinstalled rvm. I had actually attempted this two times before posting here, with the same results every time. No odd messages in the install log, but no /scripts/ directory, either. Just so I could say I had, I did it a third time at Andrew's urging. This time, I checked and the /scripts/ directory existed. Running 'type rvm | head -1' confirmed it as a 'function' and I can now move on.
Make sure that you restart a session after reinstalling, so that rvm is in your path.
You can try to logout/login.
You can also open your shell as a login shell. Under ubuntu 12.04:
Open a terminal
Edit > Profile Preferences
Under tab Title and Command, check run Command as a login shell
Open new terminal (ctrl+alt+t) and type rvm
If there's no scripts directory inside .rvm, it would seem that RVM failed to successfully complete installation. Delete the .rvm directory, try reinstalling, and look at the installation output closely to see if it's complaining about anything.

Resources