I've been following the amazingly convoluted path to installing Ruby (and Rails) on a Mac (OSX Yosemite). I used the Terminal to install rbenv. Then I tried to install Rails, following the instructions # http://rubyonrails.org/download/
Terminal displays a bunch of code that suggests the operation was a success. But when I navigate to http://localhost:3000 I get the message "This webpage is not available."
Taking another look at my Terminal code, I see a couple apparent problems at the very beginning:
rails new path/to/your/new/application
Invalid application name application. Please give a name which does not match one of the reserved rails words.
My-MacBook-Pro:~ myname$ cd path/to/your/new/application
-bash: cd: path/to/your/new/application: No such file or directory
My-MacBook-Pro:~ myname$ rails server
Can anyone explain what's going on and how I can fix it?
It looks like what is happening is that you've named your application 'application', and this is what's causing errors in your rails setup. 'application' is a keyword used internally by Rails, and is probably throwing it off.
I've always used rvm instead of rbenv. It's easy to set up on Mac OSX Yosemite using curl, and I've never had any problems installing Rails on it. Are you tied to rbenv for some reason? If not, give rvm a try : https://rvm.io/rvm/install
Related
Homebrew is already installed.
xCode is already installed too.
in use the codecademy youtube tutorial but it doesn't work :(
youtube.com/watch?v=3Lp5XP8pWkU&t=198s
i have installed rvm and i guess this will working but when i want to install ruby it looks that it works but then wenn i type $ ruby -v
i see only this message -bash: /Applications/MAMP/Library/bin/ruby: No such file or directory. i have deleted MAMP from my Mac, but this should also work without Mamp. Or am i wrong i need your help. This message is shown although when i type rails -v or rails new testApp. I cant make a new ruby on rails app. i need your help. Please take a look on the images.
Terminal Code rvm Ruby
Terminal Code error message
It seems that either your MAMP installation is broken, or MAMP itself is broken.
Can you reinstall MAMP, To "uninstall" MAMP, you only have to delete the MAMP directory and everything returns to the original state (MAMP does not alter anything on the "normal" OS X).
and then try to install ruby
$ rvm install 1.9.3
Also check your /.profile file that it has all the following entries
alias erb='/Applications/MAMP/Library/bin/erb'
alias gem='/Applications/MAMP/Library/bin/gem'
alias irb='/Applications/MAMP/Library/bin/irb'
alias rake='/Applications/MAMP/Library/bin/rake'
alias rdoc='/Applications/MAMP/Library/bin/rdoc'
alias ri='/Applications/MAMP/Library/bin/ri'
alias ruby='/Applications/MAMP/Library/bin/ruby'
alias rails='/Applications/MAMP/Library/bin/rails'
you can also use rbenv if rvm is not working for you, here is the tutorial which explains How to use MAMP with the mysql2 gem and Ruby 1.9.3-p194 via rbenv
https://gist.github.com/jakebellacera/3429066
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.
Running Mac OS X Mavericks, I have completely jacked up my Rails installation to the point that I am unable to sort out what all is wrong. I'm working through the railsapps.org book on learning rails and am simply trying to set up the test environment so I can actually start learning... Anyway, I'm so messed up now that I really just need to flush it all and start over. I have reinstalled Rails, and now the default gemset is empty. I am unable to figure out at this point how to repopulate it with the default gems (uninstalling and reinstalling Rails did not do this for me).
At this point I'm so far down a rabbit hole that I'm unable to orientate myself, so I feel like I need to just resurface and start over from zero fresh. How would I go about resetting my environment such that I can do this? I assume I need to uninstall Rails, RVM, etc?
First, make sure you are running Mac OS X Mavericks (10.9).
Start by uninstalling Ruby, for example:
$ rvm remove ruby-2.1.1
More info is on the Removing Rubies page on the RVM site.
Then carefully follow the guide Install Ruby on Rails - Mac OS X Mavericks to install Ruby 2.1.1 and Rails 4.1.
If things don't look right, for example if RVM is giving error messages, you can escalate by uninstalling RVM itself. This will removes all Ruby installations RVM manages, and everything in ~/.rvm:
$ rvm implode
Follow the Install Ruby on Rails - Mac OS X Mavericks to reinstall RVM, Ruby 2.1.1 and Rails. Take notes as you go and if you encounter any difficulties, ask a new Stack Overflow question, supplying the exact error messages and conditions that created the error. Installing Rails is the biggest obstacle to learning Rails, so good luck, and I'm sure you will succeed with the help you find here.
Yes, my teammate had this issue on linux box. He had to completely wipe ALL rails installations. Re-download/install rails installer (http://railsinstaller.org/en) for whatever OS you are using. I dont know what IDE you use... but in our case we use Eclipse with aptana. Reinstall that too then link everything back together. Then in your IDE you should have option to make a default project by calling rails new blog(replace blog with whatever your project name would be) After which you should have fresh project to work with. Don't forget to do bundle install
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
Rails and all my gem files + homebrew installs have been working fine up until this point.
I ran
homebrew install postgresql
and was following the prompts pretty much as indicated in this video but it kept giving me error messages saying there is a server already running. I checked
which psql
in the terminal and it reported a
usr/bin
location rather than
usr/local/bin
indicating I was using the postgres that comes with osx not the new homebrew install.
When I attempted to start the database server I recieved an error message saying the server is already running. There is a mention of this error message in the postgres help documentation but no real working solution.
Attempting brew doctor confirmed that i needed to change my PATH in .bash_profile.
I came across this little snippet here on stack overflow for the .bash_profile edit.
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin
I saved the file and managed to get postgres up and running fine but then when I went to start a new rails app.
rails new blog -d postgresql
it says
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.
Any attempt to install does not work until i change the bash_profile file back to what it was before.
If I change it back postgres has the same issue again saying there is already a server running.
Also I thought it might be a launch agent or something but I don't think there are any that are set up.
I figure either something is installed in the wrong place or I have to add something to the .bash_profile?
Don't set your $PATH explicitly. You should append or prepend to it instead:
# In your .bash_profile
export PATH="/usr/local/bin:$PATH"
My guess is that you either use RVM or rbenv. If you change your path to /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin explicitly then RVM or rbenv won't be in your path.