Ruby, RVM, LLVM and MySQL
Unfortunately, you're trying Rails at a bit of a bad time. There's a lot of transition at the moment, as others have mentioned Xcode 4.2 was recently released and has a new compiler, also Ruby 1.9.3 came out.
I've been developing Ruby and Rails for some years now, but trying to get up and running again after installing Lion clean this week has been more problematic than in the past.
First, make sure RVM is up to date (as the issue should be fixed):
rvm get head
Then try installing like so:
CC=/usr/bin/gcc-4.2 rvm install 1.9.3 --enable-shared
EDIT:
Note, working through my own issues I believe the first command probably fixed the problem. The second wouldn't have provided any benefit over:
rvm install 1.9.3
As on my clean install, /usr/bin/gcc-4.2 doesn't exist.
Also I wanted to add that I ended up compiling the older GCC manually for those situations where the new compiler fails. I followed this very informative blog post.
Ruby 1.9.2 under RVM and MySQL already initialized constant warnings
Do you need the mysqlplus gem? I am using Rails 3 with only mysql 2.8.1:
gem 'mysql', '2.8.1'
Although I have not used mysqlplus, I am guessing that it sets the constants you are seeing in the warnings, and then the mysql gem sets these constants again when it is loaded.
UPDATE: Use mysql2 instead
#gem 'mysql', '2.8.1'
gem 'mysql2'
You also need to update your database adapters in database.yml:
development:
#adapter: mysql
adapter: mysql2
database: somedatabase_development
Problems mixing Ruby versions with MySql client
You should set PassengerRuby
in app's virtual host as it is written in rvm doc.
Can't install Ruby under Lion with RVM – GCC issues
This answer was edited multiple times and now contains several alternative solutions. Try the simple “Edit 3” solution first.
Ruby 1.9.3-p125 and later have official support for clang, so if you are installing such a version you should not need GCC. If you’re installing an older version of Ruby, read on.
To compile Ruby with GCC, you need a non-LLVM version of GCC, which is no longer included with Xcode 4.2. Install it yourself (or downgrade to Xcode 4.1 temporarily), then do CC=/usr/local/bin/gcc-4.2 rvm install 1.9.3 --enable-shared
(substituting the path to your non-LLVM gcc).
Edit: https://github.com/kennethreitz/osx-gcc-installer/downloads may help for installing GCC. There is also some info available by running rvm requirements
.
Edit 2: For an easier solution, you can try adding --with-gcc=clang
to the arguments to configure
for Ruby to use clang instead of GCC.
Edit 3: rvm install 1.9.3 --with-gcc=clang
does that for you.
Note: With current versions of Xcode you need to install the command-line tools separately from the Xcode menu -> Preferences -> Downloads -> Components. This is a pre-requisite for doing any compiling with Xcode on the command-line, not just Ruby.
Note 2: If something doesn't work after following the steps, try doing a reboot or re-login to ensure that the environment gets set correctly.
Note 3: Ruby versions prior to 1.9.3-p125 may not always be fully compatible with clang, so test your software thoroughly if using the “edit 3” solution in a production environment.
RVM MultiUser install unsafe?
It mostly depends on how much you trust developers - mostly if they are a team or random people.
A second thing is hosting application - that's extra security problem and it's best to use new user and mixed mode rvm per every application.
If developers are going to host applications then use mixed mode for developers also - they would share only ruby - but it's a lot safer.
Refer to the installation instructions on rvm site for more details.
Can´t install a new version of ruby using rvm in Mojave
I remembered that in the last weeks I upgraded mysql from 5.6 to 5.7 so in the bash file I had some mysql5.6 configurations blocking the ruby installation. Only what I need to do was delete from bash profile the lines related with mysql5.6
Open bash file
nano .bash_profile
Delete
LDFLAGS="-L/usr/local/opt/mysql@5.6/lib"
Reload bash or open other terminal
source ~/.bash_profile
Related Topics
How to Say Something Happened "X Minutes Ago" or "X Hours Ago" or "X Days Ago" in Ruby
Ruby 'Encode': "\Xc3" from Ascii-8Bit to Utf-8 (Encoding::Undefinedconversionerror)
Why Can't Singleton Methods Be Defined on Symbols or Fixnums
When Would a Ruby Flip-Flop Be Useful
How to Make Part of a Regular Expression Optional in Ruby
Split String into a List, But Keeping the Split Pattern
Why Many People Use "-%>" Instead of "%>" in Rails
Ruby on Rails Rmagick on Windows 7
Why Does Code Need to Be Reloaded in Rails 3
What's the Point of Argv in Ruby
Set Utf-8 as Default for Ruby 1.9.3
Best Way to Highlight Current Page in Rails 3? - Apply a CSS Class to Links Conditionally
How to Generate a Human Readable Time Range Using Ruby on Rails