I've installed a Ruby gem called wordmove to work with pushing and pulling my Wordpress sites but when I run wordmove commands I get the error command not found. I've done some research and I haven't come up with much, I've come to the conclusion based on what I've seen that my Ruby install is messed up.
I ran echo "$PATH" from my root and it returned the following:
/Library/Frameworks/Python.framework/Versions/3.4/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Users/brettgolding/.rbenv/shims:/usr/local/bin:/user/local/sbin:/usr/local/mysql/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin
I am a noob with the terminal so have no idea how to clean this mess up.
So you're working with rbenv. According to its README, you should run rbenv rehash after installing any gems that have an executable command. Also, run it anytime you install a new Ruby version.
Related
Running OSX Mavericks, ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin13.0], rvm 1.25.23 (master), and rails-4.1.0 (allegedly)
I'm working through the railsapps.org book on learning rails and made it about 1/2 way through yesterday. When I stopped for the day, I closed out iTerm2 and shut off the Macbook Pro. Today, I powered up, opened iTerm, navigated to my working directory (~/rubyonrails/learn-ruby) and entered rails -v.
I see this:
`Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.`
So I run sudo gem install rails and it shows that it has installed rails-4.1.0. Now rails -v still gives me the same error message above.
I tried also running rvm use ruby-2.1.1#learn-rails first and I still get the error message.
So I'm a little stuck and I can't figure out what to do to get rails working. Also, how do I go about setting up the bash environment such that I don't have to go through this each time? It would be nice to nav to my working directory and just start work without having to do a bunch of re-installation and reconfiguration each time.
Regards,
Jeff
please type in your shell:
$ bash --login
and then repeat your commands.
rails -v
Also try to call it with the full path:
like:
/your/path/to/rails -v
I think that the shell just doesn't know where rvm/rails etc is located.
You can solve this by entering:
$ source ~/.rvm/scripts/rvm
When you switch to the ruby-2.1.1#learn-rails ruby/gemset combo, and do gem list, what do you see?
The way people usually use rvm is to have every project folder specify the ruby & gemset it uses (they don't all have to be different). This is done with files called .ruby-version and .ruby-gemset. These should contain, in your case, ruby-2.1.1 and learn-rails respectively.
Set these if you haven't already, then leave the folder and enter it again. Then do bundle install to install the gems for the project into the rvm/gemset combo.
Your problem is that you ran
sudo gem install rails
The error message telling you to do this comes from your system Ruby, which doesn't know that you want to use RVM.
RVM installs gems into your user-space directory. By using sudo, you're bypassing this and installing it into (effectively) the superuser space, i.e. globally.
If you instead just run
gem install rails
then you'll be using RVM's copy of the gem utility rather than the globally installed version.
So here is what happened:
I started working for a company and was given a macbook pro for work. I do customer support for Exceptional/Airbrake so i need to learn Ruby/Rails. So the laptop had a previous owner and i dont know what he did with it.
I tried to install Ruby and Rails and kept getting errors, then tried doing it with rvm, and i thought it was working as i could run irb and even execute a test program with ruby. I got tired of seeing the previous owners name on the command line so i changed the home folder and I am pretty sure this is where things got bad. I took the contents of rvm and everything and moved it to my User file from the old one then deleted the old one.
Everything seemed to still be working fine, but when I wanted to start working with rails as well, t it wouldnt work.So i figured i would just uninstall everything and start over, i tried rvm implode and removed all gems. when i run 'gem list', i get empty, and i cant find ruby anywhere but when i run irb, it still works. so i tried re-installing using rvm, but i keep getting errors.
The first error that occurs is:
No binary rubies available for: osx/10.7/x86_64/ruby-2.0.0-p0.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
the second error is:
Error running 'env GEM_PATH=/Users/robertmroz/.rvm/gems/ruby-2.0.0-p0:/Users/robertmroz/.rvm/gems/ruby-2.0.0-p0#global:/Users/robertmroz/.rvm/gems/ruby-2.0.0-p0:/Users/robertmroz/.rvm/gems/ruby-2.0.0-p0#global GEM_HOME=/Users/robertmroz/.rvm/gems/ruby-2.0.0-p0 /Users/robertmroz/.rvm/rubies/ruby-2.0.0-p0/bin/ruby /Users/robertmroz/.rvm/src/rubygems-2.0.3/setup.rb', please read /Users/robertmroz/.rvm/log/ruby-2.0.0-p0/rubygems.install.log
and the last error is:
ERROR: Loading command: install (LoadError)
cannot load such file -- openssl
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
I have gone through dozens of google searches, most of them leading me here, on each of these errors, and sometimes the certain error seems to be fixed, but in the end i cant get it to work. Should i just wipe the OS and start over, cause I have been trying to get this done for days now.
BTW, i dont know why it is installing 2.0.0 i thought rvm installed the latest version by default.
Before you blow out the system I'd:
Uninstall rvm (rvm implode, gem uninstall rvm) see this question
You should be left with just the base ruby. That should be the only one left.
Re-install rvm (\curl -L https://get.rvm.io without Rails).
Install the ruby version you want with rvm (rvm install 1.9.2) stay away from 2.0 for now.
Make sure your ruby version is installed and selected.
Install the rails version you want.
Hopefully that will straighten things out.
I also suffered from the same problems while installing Ruby , but after googling a lot I found the solution . Follow the below process :
If you have already installed anything uninstall all of that using Revo installer or by some other means , else go to step 2.
Next go to http://rubyinstaller.org/ and press the download button .
You will find a list of ruby versions , click on the latest version ( If you are running a 64 bit machine install the link with (x-64) else install the one without brackets .
Accept all the defaults and tick all the check boxes after downloading and setting it up , it will install in C:\ with name Ruby22 ( depending on its version )
Go to start menu type cmd , the use the command "cd C:\" without brackets , it will take you the C:\ drive
Check ruby -v , you should get the version number , else repeat the above process again .
Now use the command "gem install rails" , it will install all the rails requirements , this takes a lot of time .
Now use the command "gem install webrick" to install the web server
Now go to some browser , visit http://rubyinstaller.org/downloads/ , download the DevKit at the bottom of the page and extract it to some folder ( ex in C:\DevKit after creating the DevKit folder in C:\ )
Use the following commands in the same order
"ruby dk.rb init"
"ruby dk.rb install"
"gem install rdiscount --platform=ruby"
Rails is installed now .
Create a folder in C:\ for creating your rails apps and name the folder ( ex Rails _Apps ) use the command cd C:\Rails_apps to go there and use the command "rails new sample_rails_app" to create a Rails app with the name "sample_rails_app" .
It does a bunch of things and you are now able to use Ruby on Rails.
Ruby 2.0.0-p0 was recently released, so that is the latest version technically, although I kind of doubt you really want the latest version since it is so new and your company may still be running an older version like 1.9.3. Have you tried installing 1.9.3-p392 (the current 1.9.3 version)?
If you still get the error with 1.9.3, I would try the instructions shown on the RVM site:
$ rvm pkg install openssl
$ rvm reinstall 1.9.2 --with-openssl-dir=$rvm_path/usr
I have been trying to get my dev environment setup on my computer for a number of days now, but without any luck. I've had more error messages than I could care to remember and my installation problems have been anything but consistent.
My current problem is unknown as I don't know where its stemming from.
When I try to check my gem version gem -v, the terminal locks up for a couple minutes and then gives me this output:
/Users/Riley/.rvm/bin/gem: line 6: /Users/Riley/.rvm/bin/gem: Argument list too long
/Users/Riley/.rvm/bin/gem: line 6: /Users/Riley/.rvm/bin/gem: Undefined error: 0
The entire contents of that file are as follows:
#!/usr/bin/env bash
if [[ -s "/Users/Riley/.rvm/environments/ruby-2.0.0-p0" ]]
then
source "/Users/Riley/.rvm/environments/ruby-2.0.0-p0"
exec gem "$#"
else
echo "ERROR: Missing RVM environment file: '/Users/Riley/.rvm/environments/ruby-2.0.0-p0'" >&2
exit 1
fi
And I don't have a clue what its supposed to be, if not that. Checking which ruby gives me:
/Users/Riley/.rvm/bin/ruby
And the problem really seems to come alive when I try to install rails, gem install rails:
ERROR: Loading command: install (LoadError)
cannot load such file -- openssl
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
** This error has ceased to occur and is now replaced with the above "line 6" error for gem -v, however I'm sure it will show up again.
I have also tried all of this:
rvm get head --autolibs=3
rvm pkg remove
rvm reinstall all --force
and all the other renditions of solutions on SO and many other sites.
I would greatly appreciate someone helping me with this setup as I don't have any solution to my problem outside of google and SO.
The problem stemmed from my installation of Ruby. Apparently, as stated in this answer, "a non-LLVM version of GCC" is no longer included in the XCode command line tools.
Installing ruby with:
rvm install ruby --with-gcc=clang
Worked and I installed RVM, Ruby and Rails within about 10 minutes, despite it taking me a week of debugging and reinstalling otherwise.
Run rvm requirements and install all the dependencies as specified (openssl being one of them). It should fix your problem.
I guess I messed things up a little bit:
I wanted to play around with Ruby on Rails a little bit. I installed it a year ago but never used it. Till now.
Because of some problem a ran into I wanted to start from beginning with a fresh install. I uninstalled the Rails gems (3.0.7 and 3.1.1) and followed this guide for a fresh install: http://eddorre.com/posts/rails-ultimate-install-guide-on-os-x-snow-leopard-using-rvm-homebrew-and-passenger
But now gem does nothing - when I type gem install bundle in my terminal the cursor goes straight to the next line. Even gem list or gem --help doesn't work. I get no error messages.
I have no clue what happened. Some thoughts?
I'll do a full reinstall of rvm:
rvm implode
and start again:
bash <<(curl -s https://rvm.beginrescueend.com/install/rvm)
If you try to recover the existing environment, there are some options to rvm that can be useful:
debug - show info plus additional information for common issues
upgrade - Lets you upgrade from one version of a ruby to another,
including
migrating your gemsets semi-automatically.
cleanup - Lets you remove stale source folders / archives and
other miscellaneous
data associated with rvm. repair - Lets you repair parts of your environment e.g. wrappers, env files and
and similar files (e.g. general maintenance).
Since you're trying to start over anyway, I would highly recommend that you use RVM. Do the "single user install" and these gem problems should disappear entirely. Then if you get a specific error message, post that so we have something to go on.
Please run this command in your console:
gem env
This command will return your gem environment, and one more correction: I guess it should be 'gem install bundler' not 'gem install bundle'.
Ok, so I decided I'd be cool and try to use Rails3 that's in beta. Then, things were getting hard to manage so I got rvm. I installed ruby 1.9.2-head in rvm and things were working, and then a computer restart later rails wouldn't start up. So I figured I'd just try running the system ruby and start rails in it. same error. Then, I uninstalled rails3 and got rails: no such file or directory type errors..
So now I'm royally screwed because rails2 is still installed but will not uninstall because of invisible dependencies, along with a lot of other random gems. How do I completely clear out all ruby gems and such so I can start anew?
I've recently had to so just this. I had built up alot of cruft with my system installed ruby and gems and wanted to clean all that out and move everything over to run under rvm for various projects.
1. Clean up old and busted
First thing I did, before messing with rvm (or run rvm system to get back to the system ruby), was to remove all my gems:
gem list | cut -d" " -f1 | xargs gem uninstall -aIx
WARNING: this will uninstall all ruby gems. If you installed as root you may want to switch to root and run this.
2. Install new hotness
Now you can run gem list to see what is left.
Time to install rvm, I recomend blowing away your current install and reinstall fresh:
rm -rf $HOME/.rvm
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
Now the real trick is to use gemsets to install rails 3, and this is easy if you follow Waynee Seguin's gist:
rvm update --head
rvm install 1.8.7
rvm --create use 1.8.7#rails3
curl -L http://rvm.beginrescueend.com/gemsets/rails3b3.gems -o rails3b3.gems
rvm gemset import rails3b3.gems
One difference is I use 1.8.7 since I have had issues with 1.9.2-head and RSpec, but 1.8.7 has been smooth.
You say that you already got Rails 2 and afterwards installed rvm. Try if you can remove Ruby and Rails using the package manager of your system (yum, apt, ...)
The error you got is most likely the result a link in some general place which still exists, but is pointing to the real installation directory which no longer exists.
For example: /usr/bin/ruby exists and is pointing to /usr/local/lib/ruby/1.9.2/bin/ruby which no longer exists.
Afterwards manually clean out any Ruby and Rails related paths in /usr and its subdirectories.