Ask A Question


You’re not receiving notifications from this thread.

Setup MacOS 10.10 Yosemite Discussion

Chris Oliver asked in General

Installing Rails
Choose the version of "Ruby" you want to install:
I have no experience in Ruby and i can even see something wrong there.


please can someone advise me on how to update your config/database.yml file to match the database username and password. I'm really new at this. Thank you


facades-MacBook-Air:demo facade$ ruby -v

ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]

facades-MacBook-Air:demo facade$ rails -v

Rails 4.2.0

facades-MacBook-Air:demo facade$ gem -v


facades-MacBook-Air:demo facade$

facades-MacBook-Air:demo facade$ rails server

=> Booting WEBrick

=> Rails 4.2.0 application starting in development on http://localhost:3000

=> Run `rails server -h` for more startup options

=> Ctrl-C to shutdown server


/Users/facade/Project/rails/demo/config/environments/development.rb:1:in `<top (required)="">': undefined local variable or method `demo' for main:Object (NameError)

from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'

from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'

from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'

from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'

from /Library/Ruby/Gems/2.0.0/gems/railties-4.2.0/lib/rails/engine.rb:598:in `block (2 levels) in <class:engine>'


I got as far as:

gem install rails -v 4.2.0

Then it failed:

ERROR: Error installing rails:
ERROR: Failed to build gem native extension.

/Users/billtubbs/.rbenv/versions/2.2.1/bin/ruby -r ./siteconf20150325-2154-64wma0.rb extconf.rb
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
The file "/usr/include/iconv.h" is missing in your build environment,
which means you haven't installed Xcode Command Line Tools properly.

To install Command Line Tools, try running `xcode-select --install` on
terminal and follow the instructions. If it fails, open,
select from the menu "Xcode" - "Open Developer Tool" - "More Developer
Tools" to open the developer site, download the installer for your OS
version and run it.

Tried both these methods and when I ran the command-line install method I get this:

xcode-select: error: command line tools are already installed, use "Software Update" to install updates


Is this article up to date? There is a Ruby on Rails version 4.2.1 now. Also I'm using OS X 10.10.2 and XCode 6.2. Should I even be following this? Thanks.


Very Good! Thanks


Thanks for the great tutorial. Everything worked perfectly. Thumbs up!


Gem files will remain installed in /Users/winniecheung/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/pg-0.18.1 for inspection.

Results logged to /Users/winniecheung/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/pg-0.18.1/gem_make.out

An error occurred while installing pg (0.18.1), and Bundler cannot continue.

Make sure that `gem install pg -v '0.18.1'` succeeds before bundling.

but when I try to install pg-v '0.181'

/Users/.rbenv/versions/2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/ext/builder.rb:73: warning: Insecure world writable dir /usr/local in PATH, mode 040777

ERROR: Error installing pg:

ERROR: Failed to build gem native extension.

/Users/winniecheung/.rbenv/versions/2.2.1/bin/ruby -r ./siteconf20150416-11658-1dycw7z.rb extconf.rb

checking for pg_config... no

No pg_config... trying anyway. If building fails, please try again with


checking for libpq-fe.h... no

Can't find the 'libpq-fe.h header

*** extconf.rb failed ***

Could not create Makefile due to some reason, probably lack of necessary

libraries and/or headers. Check the mkmf.log file for more details. You may

need configuration options.

Provided configuration options:


























extconf failed, exit code 1

Gem files will remain installed in /Users/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/pg-0.18.1 for inspection.

Results logged to /Users/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/pg-0.18.1/gem_make.out


Sounds like you didn't insTall Postgres yet. Doing that should fix yOur problem.


Could anyone help me out?

I'm getting the following error while installing Rails.

ERROR: While executing gem ... (Errno::EACCES)

Permission denied - /Library/Ruby/Gems/2.0.0/i18n-0.7.0.gem


I got this error while installing rails...

ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /Library/Ruby/Gems/2.0.0/i18n-0.7.0.gem

Can anybody help me out, please? I'm new to this.


It sounds like you aren't using the proper version of Ruby and it's trying to install in your system Ruby. Make sure you didn't miss any commands and try restarting your terminal. When you run "which ruby" you should get something like "/Users/chris/.rbenv/shims/ruby".


Everything works great until I get to the rails portion where I get 'extconf failed, exit code 1'

Any advice? Everything I searched for hasn't helped yet.

Kevin Budd Kevin Budd

was having same problem, found this,

specifically, xcode-select --install, in the terminal worked for me to get past error


Is it normal to have Ruby version different to RubyGems version? Here's a screenshot of what I'm talking about:


Yes, Ruby and Rubygems get updated at different times. Everything looks good there but you should upgrade to Rails 4.2.1! :)


Hi, i truly enjoyed the post. Very helpful. Now I have with the installation i get this error

Access denied for user 'root'@'localhost' (using password: YES) . I have a question can a previous installation of MySQL server and Apache server cause conflict with the installation with Ruby on Rails? If not how to solve this problem.


Hey Sarah, if you haven't fixed this yet, the error basically says that your database password doesn't match what was set up with MySQL. If you used homebrew to install it, then the username is usually the same as the user you login as and the password is empty.


I'm having a problem in installing ruby:

1) First I did $ rbenv install 2.2.2, it gave error.

2) Then I did $ sudo rbenv install 2.2.2, it returned:
Installed ruby-2.2.2 to /Users/mavericks/.rbenv/versions/2.2.2

3) Then I did the other one, $ rbenv global 2.2.2, returned “permission denied”. So I did with sudo and it returned no errors.

But now when I do $ ruby -v it returns ruby 1.9.3p547 (2014-05-14 revision 45962) [x86_64-darwin13.2.0]

And when I do $ rbenv versions it returns:
* 2.2.2 (set by /System/Library/Frameworks/Ruby.framework/Versions/.ruby-version)

So, it seems that I have 2.2.2 installed but I doesn't run it when I try to through rbenv.
Anybody can help me?


I get this error message during the rails installation step, after pasting the command "gem install rails -v 4.2.1" in terminal:

Error installing rails:

invalid gem: package is corrupt, exception while verifying: undefined method `size' for nil:NilClass (NoMethodError) in /Users/avinash/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/cache/activesupport-4.2.1.gem

Help appreciated.

Keith Greatz Keith Greatz

Edit - After a little perseverance all is now working as you have explained, amazing how one little deviation from the original instructions can cause issues, thanks for the guide Chris!


If you have issues when first connecting to your local psql service ("psql: FATAL: database “<user>” does not exist"), try this :


When I type "launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist" I have an error: "/Users/admin/Library/LaunchAgents/homebrew.mxcl.postgresql.plist: Not a directory". Thanks for help

Arjun Mayilvaganan Arjun Mayilvaganan

Actually I had Git configured before following these steps itself. So, just to test the working, i tried,

ssh -T

But, the output was, "Permission denied (publickey)"

So, tried configured again exactly as per the steps above and the result didn't change.
But, I have been using GitHub without any problem before on my mac.
Does this output affect my use of Ruby on Rails?
Please help. :)
Thanks In Advance.


Help!? don't know how to fix this, I run this command:
gem install rails -v 4.2.1


Hey everyone,

Bit of help needed:

ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory

How do i fix?


Looks like you may not be using the Ruby (and the gem command) from the rbenv install. Try restarting your terminal and making sure you get something like "/Users/chris/.rbenv/shims/ruby" from running "which ruby"

Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 78,890+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

    © 2023 GoRails, LLC. All rights reserved.