Error installing Ruby in Yosemite
Thanks @JanStrnádek for the answer. I solved all the dependencies from left to right and installed gcc using the below command and tried installing ruby again. It worked.
brew install homebrew/versions/gcc48
Can't start ruby from osx yosemite terminal, before and after rbenv, homebrew works though
When you enter ruby
at the command-line, it's supposed to "hang forever". It's waiting for you to give it instructions. You can use CTRL+D to get it to stop waiting:
> ruby
puts 1 + 1
2
I then did CTRL+D and returned to the command-line prompt.
Instead though, we don't use Ruby like that. If we want to use it interactively, we use IRb which comes with Ruby. It's the "interactive" Ruby:
> irb
Welcome to IRB. You are using ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin13]. Have fun ;)
>> 1 + 1
2
>> 'foo'.squeeze('o')
"fo"
If we want to run a Ruby script, we use something like:
ruby /path/to/script
and Ruby will load and run it.
I'd recommend reading some Ruby tutorials and learn how the language works before trying to use Rails. Rails uses deep Ruby magic and how Rails works will be unfathomable to you until you do understand better how Ruby is used and how it works and what it can do.
If you're using rbenv to manage your Ruby, then when you enter rbenv versions
you should see the Rubies it manages listed:
rbenv versions
system
1.9.3-p551
* 2.2.2 (set by /Users/tinman/.rbenv/version)
If you don't, either rbenv isn't in control of Ruby, or you haven't installed any using rbenv. rbenv global system
will tell it to use whatever you have installed by default in the system, based on your PATH.
rbenv's documentation and built-in help go over this so if the problems continue then you need to closely examine your install and setup, because 90% of the problems we see using a sandboxed Ruby are due to people not paying attention to the directions, or using the wrong ones, and not completing the installation.
Rails 4.1 Unable to install Elasticsearch on Mac OS X Yosemite using Homebrew
this seems to be a problem with homebrew and yosemite. maybe this can help? https://apple.stackexchange.com/questions/153790/how-to-fix-brew-after-its-upgrade-to-yosemite
How to update Ruby Version 2.0.0 to the latest version in Mac OSX Yosemite?
Open your terminal and run
curl -sSL https://raw.githubusercontent.com/rvm/rvm/master/binscripts/rvm-installer | bash -s stable
When this is complete, you need to restart your terminal for the rvm
command to work.
Now, run rvm list known
This shows the list of versions of the ruby.
Now, run rvm install ruby@latest
to get the latest ruby version.
If you type ruby -v
in the terminal, you should see ruby X.X.X
.
If it still shows you ruby 2.0.
, run rvm use ruby-X.X.X --default
.
Prerequisites for windows 10:
- C compiler. You can use http://www.mingw.org/
make
command available otherwise it will complain that "bash: make: command not found". You can install it by runningmingw-get install msys-make
- Add "C:\MinGW\msys\1.0\bin" and "C:\MinGW\bin" to your path enviroment variable
Related Topics
How to Use Active Support Core Extensions
What's This &Block in Ruby? and How Does It Get Passed in a Method Here
What Are Some Good Ruby-Based Web Crawlers
How to Replace a Hash Key with Another Key
Equivalent of .Try() for a Hash to Avoid "Undefined Method" Errors on Nil
Is There a Better Way of Checking Nil or Length == 0 of a String in Ruby
Get Index of Array Element Faster Than O(N)
Gem Install Therubyracer' Fails on MAC Os X Lion
How to Use Rvm and Create Globally Available Gems
What Is the Use of Gemfile in Rails
How to Search a Folder and All of Its Subfolders For Files of a Certain Type
Automatic Counter in Ruby For Each
Rails: an Elegant Way to Display a Message When There Are No Elements in Database