trying to install bcrypt-ruby-2.1.4. I have to use rvm to remove ruby 1.9.2, then reinstall/compile, then I can install the bcrypt gem, however the gem is only active in that one terminal session. If I open another tab in terminal I get the following error "Could not find bcrypt-ruby-2.1.4 in any of the sources"
If I close the terminal, I will no longer be able to use the bcrypt gem (or json, or cucumber) unless I remove and recompile ruby again?
Not sure how to even google for help on this? Any ideas or help would be greatly appreciated.
Bobby
running osx 10.6.8
ruby 1.9.2-p180
You're probably using a different rvm set when you're opening a new terminal.
Since OS X doesn't come with Ruby 1.9.2, you are being defaulted to the system installation of Ruby.
http://beginrescueend.com/rubies/default/ Check out this link to learn how to set a default Ruby version.
Go to your terminal and type in
rvm --default use 1.9.2
This will make 1.9.2 the default Ruby in all Terminal windows.
Related
So I'm a rails developer familiar with Rails 3 and 4. I'm taking on a Rails 1.1.2 project, and the first problem I'm having is getting the server running.
I'd really love some help figuring out what I'm missing setting up the environment. When I run script/server, I get:
-bash: script/server: /Users/michael/.rvm/gems/ruby-1.9.3-p545: bad interpreter: Permission denied
This is after noting that at the top of the script/server file, there's an opportunity to define the location of the ruby install with a ruby comment:
#!/Users/michael/.rvm/gems/ruby-1.9.3-p545
At least, this is how I understand it. What should this comment point to? Does this look correct? I've installed ruby 1.9.3 using rvm and installed rails V 1.1.2 through sudo gem install rails. Everything seemed to work fine.
Is this some kind of bash permissions issue? I really don't understand what's going on. Any help would be appreciated!
I believe a rails project that old will require Ruby 1.8.7, so you should start with an older version of Ruby just to be sure. Once you get it running with the older ruby version, you can try 1.9 again, but trying it with 1.8.7 should help you out a bit. Your shebang should be able to do this though:
#!/usr/bin/env ruby
It needs the path of the ruby interpreter, which can be obtained dynamically via the above line.
I'm new to rails. After finally getting my environment to work properly with RVM 2.0.0 rails 4.0.5, all of a sudden rails disappeared and I keep getting the message: Rails is not currently installed on this system...
When I quit terminal, reopen it, and type:
$ rails v
It shows 4.0.5
However, as soon as I change directory into my rails app and check the rails version I get the message that rails is not installed.
Any idea what's going here?
When you use rvm you have multiple versions of ruby installed. You select which one you want like this:
rvm use 2.0
or
rvm use 2.1
You can also specify a ruby version in a .ruby-version file in a directory. Then when you change to that directory in the terminal, RVM will switch versions for you.
Each version of ruby has its own set of installed gems. Rails is a gem.
Ergo, when you installed rails, you were in your default ruby version (probably the one build-in on your system). When you change directory to your rails application, RVM is kicking in to switch to the correct ruby version for you. But you don't have rails installed in that version.
So the solution is to switch to the directory for your rails app and run:
bundle install
This will install your gem bundle for your application, including the rails gems, and it will do it into the correct ruby version.
This is a beginner-level question.
I'm using Ubuntu 12.04
I copied a project (created on Rails 4 using the rails new command) from Dropbox to my local environment, where I have previously install Rails 4 and up-to-date Ruby and RVM, went to project's directory, typed rails server and got
The program 'rails' is currently not installed. You can install it by typing:
sudo apt-get install rails
I ran gem install rails instead.
Will I have to run gem install rails on every project's directory? I thought the Rails install was a general and accessible on my whole environment.
The project was created using the same Ruby version, but on a MacOS X system.
The project is a static web brochure and has no database configuration.
Thank you in advance.
Make sure you're using the correct version of Ruby - the same version that you'd installed Rails into - with rvm list.
You likely have two of them (since you have such an issue) - the system Ruby and the RVM-installed Ruby. And likely RVM didn't engage and hook up the correct path to the rails executable, thus the error.
This should fix the issue:
rvm use whatever-ruby-you-had-installed-rails-into
Where whatever-ruby-you-had-installed-rails-into is a string like ruby-2.1.0-p0 taken from the rvm list output.
To make RVM retain Ruby version for the project.
echo whatever-ruby-you-had-installed-into >.ruby-version
in your project's path.
So after a few hours of testing, reproducing the problem, and reading (the other answers inclusive) I got the solution as follows:
Short answer: No. Rails needs to be installed only once.
Long answer: This problem occurred because of a default setting on Terminal that prevents the system from using RVM installations of ruby and rails. The solution is to integrate RVM with gnome-terminal as described in the RVM website.
With terminal window active, go to the menu at the top bar
Edit > Profile Preferences > Title and Command tab
Check the Run command as a login shell box
Restart Terminal and make sure your gemset and ruby version are set
rails server should now work as expected (you might be prompted to run bundle install before Rails can actually run fine, follow the promtp).
I am still learning to work with Ruby on Rails, so any inputs, clarifications, or additional information on the issue is more than welcome.
You don't have to install Rails on every project, but the gems that you need for that project.
With bundle install you install all the gems that you specify in Gemfile.
If you want to avoid reinstall the gems every time you change project, I suggest you to have a better look to RVM: it has got an opt called gemset (https://rvm.io/gemsets), if you use it you just need to switch your gemset:
rvm gemset use yourgemset
I hope it can help you.
I installed ruby as per instructions given here but when I do ruby--version then it still shows 1.8.7. How do I make sure I use newly installed Ruby?
I would suggest you to use RVM (Ruby Version Manager). You may find a full installation guide here:
http://ryanbigg.com/2011/06/mac-os-x-ruby-rvm-rails-and-you/
If you get an error such as "ERROR: Error running ' ./configure...." after executing rvm install e.g.
rvm install 1.9.3
Then you may try to install it like this:
rvm install 1.9.3 --with-gcc=clang
Note: in the guide this possible error is not described
Did you properly setup your PATH? What's the output of echo $PATH? /usr/local/bin has to come first they way this tutorial sets up things. You see that everything worked right when which ruby displays /usr/local/bin/ruby.
Personally I'd recommend using a tool for managing Ruby versions though. RVM still seems to be the most popular choice, I prefer the combination of rbenv and ruby-build.
I am extremely frustrated with ruby on Mac OS X. I have tried RVM and regular installations of ruby, and nothing seems to get it to work well. With RVM, rails throws errors at me, and with a regular installation of ruby 1.9.2-p180, somehow my computer reverts back to ruby 1.8.7 over time. Can someone please help? A detailed instruction on how to just reset my ruby installation from a clean slate would be very helpful.
Thanks so much in advance!
I'm using macports for all my needs:
go to www.macports.org
download installation dmg
install it
open a new Terminal windows (or source ~/.profile )
port selfupdate
port search ruby
pick what one want (ruby for 1.8.7, or ruby19 for 1.9.2)
sudo port install ruby
port search rb-
pick what want and install
everything will install into /opt - so does not interfere with your standard system binaries.
Note, than everything will compile - and take a long time.
rvm --default use 1.9.2
This has been covered multiple times here. A simple search will find many questions.
See:
Installing RVM (Ruby Version Manager)
and
i installed ruby 1.9.2 with RVM, but when i type "ruby -v" is telling me the ruby v i have is 1.8.7 (mac)