RVM warning when installing Passenger on the Mac - passenger

Installing Passenger on the Mac runs into this problem.
Any suggestions?
sudo passenger-install-apache2-module
...
* Checking for Zlib development headers...
Found: yes
Location: /usr/local/include/zlib.h
Your RVM wrapper scripts are too old, or some wrapper scripts are missing. Please update/regenerate them first by running:
rvmsudo rvm get stable && rvm reload && rvmsudo rvm repair all
If that doesn't seem to work, please run:
rvmsudo rvm wrapper [] --no-prefix --all
First I did:
$ rvmsudo rvm get stable && rvm reload && rvmsudo rvm repair all
Warning: can not check `/etc/sudoers` for `secure_path`, falling back to call via `/usr/bin/env`, this breaks rules from `/etc/sudoers`. export rvmsudo_secure_path=1 to avoid the warning.
which re-installed rvm and then I did:
$ rvmsudo rvm wrapper [] --no-prefix --all
Warning: can not check `/etc/sudoers` for `secure_path`, falling back to call via `/usr/bin/env`, this breaks rules from `/etc/sudoers`. Run:
export rvmsudo_secure_path=1
to avoid the warning, put it in shell initialization file to make it persistent.
In case there is no `secure_path` in `/etc/sudoers`. Run:
export rvmsudo_secure_path=0
to avoid the warning, put it in shell initialization file to make it persistent.
awk: nonterminated character class ^[]=
source line number 1
context is
>>> /^[]=/ <<<
sed: 1: "s#^[]=##
": unbalanced brackets ([])
Unknown ruby interpreter string component: '[]'.
Could not load ruby [].

Add to your ~/.profile or ~/.bash_profile
export rvmsudo_secure_path=0
You may try to install passenger without sudo.
$ passenger-install-apache2-module

Related

ERROR: Missing RVM environment file After Doing rvm upgrade command - Passenger 4.0.23

I was running ruby 2.0.0-p247 on my Mac Mini Server (Mavericks 10.9.1). I read that there was a security vulnerability so I decided to upgrade to use the latest Ruby patch 2.0.0-p353. I did the following commands:
gem update --system (RubyGems 2.1.11)
rvm get stable (RVM 1.25.0)
rvm upgrade 2.0.0-p247 2.0.0-p353 (which should have moved my gemsets)
There is nothing in my system that I can find that references 2.0.0-p247 in rvm which is what I expected. When I go to ~/myuser/.rvm/environments there is no file 2.0.0-p247.
I am now attempting to start passenger. I had version 4.0.23 enterprise installed. I attempted to run rvmsudo passenger-install-apache2-module but got an error.
cd /Users/myuser/.rvm/gems/ruby-2.0.0-p353#mygemset/gems/passenger-enterprise-server-4.0.23
/Users/myuser/.rvm/wrappers/ruby-2.0.0-p353# mygemset/rake apache2:clean apache2 RELEASE=yes
# /Users/myuser/.rvm/wrappers/ruby-2.0.0-p353# mygemset/rake apache2:clean apache2 RELEASE=yes
ERROR: Missing RVM environment file: '/Users/myuser/.rvm/environments/ruby-2.0.0-p247#LightBeCorp_Rails4Ruby2'
Here are statements in my .bashrc file related to rvm if this will help.
[[ -s "$HOME/.rvm/scripts/rvm" ]]
PATH="$PATH:$HOME/.rvm/gems/ruby-1.9.3-p327#mygemset/bin:/.rvm/rubies/ruby-1.9.3-p327/bin/ruby:/.rvm/rubies/ruby-1.9.3-p448/bin/ruby:/.rvm/rubies/ruby-2.0.0-p353/bin/ruby:/usr/bin/psql:/usr/local:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
I did a rvm list rubies command. ruby-2.0.0-p247 is not listed.
Any help would be appreciated. I will continue looking. I plan to post a link to this in the Phusion Passenger group.
UPDATE 12/21/2013 12:20 pm
I updated my .bashrc file to the following since I no longer use the other rubies in my Rails applications. I still get the error when I try to run rvmsudo passenger-install-apache2-module.
[[ -s "$HOME/.rvm/scripts/rvm" ]]
PATH="$PATH:$HOME/.rvm/rubies/ruby-2.0.0-p353/bin/ruby:/usr/bin/psql:/usr/local:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
looks like a bug, please open a ticket here: https://github.com/wayneeseguin/rvm/issues
Indeed this was a bug, to fix it run:
rvm get head
rvm gemset reset_env
you can repeat the reset_env operation for every gemset that is broken:
rvm ruby#gemset do rvm gemset reset_env
There might be a cached bin file in your RVM path. In my case, it's "/usr/local/rvm/bin/unicorn"
Also, you may not directly having the gem in your Gemfile. In my case, I do not have "unicorn" in my Gemfile although I had "capistrano-unicorn".
So that the system will try to use the global cached file "/usr/local/rvm/bin/unicorn".
The file's content may using a ruby that you no longer use.
if [[ -s "/usr/local/rvm/environments/ruby-2.0.0-p247" ]]
then
source "/usr/local/rvm/environments/ruby-2.0.0-p247"
exec unicorn "$#"
else
echo "ERROR: Missing RVM environment file: '/usr/local/rvm/environments/ruby-2.0.0-p247'" >&2
exit 1
fi

rvmsudo gem install capistrano

When running
rvmsudo gem install capistrano
I get this warning:
Warning: can not check `/etc/sudoers` for `secure_path`, falling back to call via `/usr/bin/env`, this breaks rules from `/etc/sudoers`. Run:
export rvmsudo_secure_path=1
to avoid the warning, put it in shell initialization file to make it persistent.
In case there is no `secure_path` in `/etc/sudoers`. Run:
export rvmsudo_secure_path=0
to avoid the warning, put it in shell initialization file to make it persistent.
I'm on Mac OS X and I've got no secure_path in /etc/sudoers so I assume I need to put:
export rvmsudo_secure_path=0
in my .bash_profile, right?
Yes, based on the RVM warning, your .bash_profile is the correct place to put that export line.
Aside from that issue though, is using rvmsudo necessary? If you are using RVM you should be able to install gems without sudo (because they are installing into your home directory, or a user writable system directory).

rake sometimes won't work until "rvm use"

I've got Ruby, Rails, Rake and friends all working pretty well using RVM on OSX, but when I start a new shell (new tab in Terminal.app) rake tasks seem to "lose" their environment:
$ rake my_module:my_task
Could not find uglifier-1.2.7 in any of the sources
Run `bundle install` to install missing gems.
If I issue "rvm use" (which, I believe merely prints the current ruby, but does not alter anything) then it works fine:
$ rvm use
Using /Users/username/.rvm/gems/ruby-1.9.3-p194
$ rake my_module:my_task # works fine now!
It seems to happen when a new shell is started. I have rvm installed as a single-user installation, with the following at the bottom of my .bash_profile:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
I've verified that my .bash_profile is in fact executing by putting some echo statements after that line; I see the echo on the command line when I open a new tab, so it seems to be working. Any idea why rake doesn't work without "rvm use"?
Try setting rvm ruby to default ruby
$ rvm use ruby-1.9.3-p194 --default
This should use the rvm ruby-1.9.3-p194 every time as default.

Not able to install a gem file?

Hi People I am trying to install a gem file through command prompt on MAC using the following command "gem install filename" but whenever I try to execute the command I get the following error
WARNING: Installing to ~/.gem since /Library/Ruby/Gems/1.8 and
/usr/bin aren't both writable.
WARNING: You don't have /Users/hemmanshu/.gem/ruby/1.8/bin in your PATH,
gem executables will not run.
ERROR: Error installing frank-cucumber-0.8.14:
cucumber requires gherkin (~> 2.10.0, runtime)
every time I try to execute this command the same thing pops up.
You need to install gems with superuser privileges so you should to use
sudo gem install [gemname]
instead of
gem install [gemname]
U try with sudo. like "sudo gem install filename"
...Most of the time this is a PATH issue, Suppose you are using zshell as me, then add this line at the end of ~/.zshrc file
export PATH="$PATH:$HOME/.gem/ruby/2.1.0/bin"
If you are using bash as default shell then add this line to end of ~/.bashrc file
export PATH="$PATH:$HOME/.gem/ruby/2.1.0/bin"
For your case it will be like this:
export PATH="$PATH:$HOME/.gem/ruby/1.8/bin
Lastly don't forget to reload the shell by source ~/.zshrc incase of z-shell or source ~/.bashrc incase of bash-shell. I think this helps someone.

Trouble on uninstalling RVM

I am running Ubuntu 10.04 Lucid and I was probably wrong to uninstall RVM and now it seams to be not completely removed from the system. Now I would like to install that again but I am in trouble.
What happens is that I have strange outputs generated when I try to execute some command lines:
# Note that following command lines don't output the version
# (between the word "version" and the word "is") as it should be.
$ rvm
$ rvm -v
> -bash: /usr/local/rvm/scripts/base: No such file or directory
> A RVM version is installed yet 1.10.3 is loaded.
> Please do one of the following:
> * 'rvm reload'
> * open a new shell
# Even if I use the 'cd' command I have problems...
$ cd ..
> -bash: /usr/local/rvm/scripts/initialize: No such file or directory
> -bash: /usr/local/rvm/scripts/hook: No such file or directory
That probably means that RVM is not correctly removed even if Ruby seams to be running as well:
$ which ruby
/usr/local/bin/ruby
$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
So, what I can do to completely remove/uninstall RVM?
UPDATE
I solved part of the problem (or, maybe, all problems): that (those) was related to Phusion Passenger that was still loading the old path related to the Ruby version managed by RVM.
first try echo $rvm_path - if that shows anything - rm -rf it
second:
sudo rm -rf /ust/local/rvm /etc/rvmrc /etc/profile.d/rvm.sh ~/.rvm*
next check ls -l /usr/local/bin | grep rvm this will show links to rvm - rm -rf them
and last which rvm - if it shows anything try to check this path and remove at least this file.
RVM installs everything into ~/.rvm. To remove RVM from your system run 'rm -rf ~/.rvm'.
Refer this. and where is everything installed to?
From rvm help:
implode - (seppuku) removes the rvm installation completely.
This means everything in $rvm_path (~/.rvm || /usr/local/rvm).
This does not touch your profiles. However, this means that you
must manually clean up your profiles and remove the lines which source RVM.
Judging from your $PATH you can also (alternatively) remove all of the following files and directories:
/usr/local/rvm
/etc/rvmrc
/etc/profile.d/rvm.sh

Resources