Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Ben Anggoro
Ben Anggoro
36,161 Points

My system is ready to brew but I don't have rails anymore?

Hello everyone,

I just started learning rails and like it until this headache I got after I started Active Records Basics course. Before this all was fine, I got rails installed and able to finish the rails starter courses (treebook, etc)

I follow along Hampton's video with rails new biller with mysql, but then my terminal complains saying i dont have mysql.

OK so I google around and seems that all leads to installing homebrew. Fine, i installed brew, then got mysql installed but still having problem that I can't remember what it is cause it's been so many of 'em.

In short, I ran brew doctor and getting these diagnoses that I've followed, I even uninstall xcode and mavericks cause of this ran brew doctor again, another warnings, then re-install Command Line Tools, yada yada yada finally i got no warnings and it says "Your system is ready to brew".

Great, I thought. But noooooo... Now I keep getting this when try to run rails whatever

dyld: Library not loaded, Reason: image not found

I've been to rvm.io and then after hours of reading i tried this

rvm reinstall all --force

Then I get

bash: line 709: /Users/BenBKK/.rvm/RELEASE: Permission denied
Could not update RVM, get some help at #rvm IRC channel at freenode servers.

Can anyone pleeeeease help

Thanks in advance!

5 Answers

Ben Anggoro
Ben Anggoro
36,161 Points

OK that didn't quite do the job, turned out!

I rails new biller -d mysql and here's what got:

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

An error occurred while installing mysql2 (0.3.16), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.16'` succeeds before bundling.

So I did

sudo gem install mysql2 -v '0.3.16'

but didn't work I think something from brew stopped the thing. I can't remember what it is and couldn't find again but here's what I did:

brew unlink myql
//then link again
brew link mysql

Then once again I try

rails new biller -d mysql

Then again I got the error message saying mysql2 0.3.16 must be successfully installed first So crossed my fingers, I tried again sudo gem install mysql2 -v '0.3.16' and this time it works! After its done i just go back to the biller app and finish the bundle

Yay!

A permission denied error is sometimes related to how rvm was installed. If rvm was installed as the root user, this may be the reason you are receiving this error. Try entering your command like this:

sudo rvm reinstall all --force

If that works then it is definitely a permission issue. Since rvm was installed as the root user, you would need to enter the sudo command each time or I think that you could probably use a command like this to fix the rvm permission error

sudo chown -R BenBKK .rvm

Hope this points you in the right direction.

Gary

Ben Anggoro
Ben Anggoro
36,161 Points

Hi Gary,

yes i've tried sudo and change some directory permissions as well but keep getting this

dyld: Library not loaded: @@HOMEBREW_CELLAR@@/openssl/1.0.1h/lib/libssl.1.0.0.dylib
  Referenced from: /usr/local/opt/openssl/bin/openssl
  Reason: image not found

but I think i'm figuring out how (until now the terminal is still busy downloading installing some stuff so im still crossing my fingers) but I'm writing it down anyway here as note... cause so many steps and tries

First i reinstall openssl with homebrew

brew reinstall openssl

Then link openssl

brew link openssl --force

Then i tried the above, but didn't work still, i got

Warning! PATH is not properly set up, '/Users/BenBKK/.rvm/gems/ruby-1.9.3-p448/bin' is not at first place,
         usually this is caused by shell initialization files - check them for 'PATH=...' entries,
         it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
         to fix temporarily in this shell session run: 'rvm use ruby-1.9.3-p448'

Then I just copy paste all the yadda yadda yadda above on google and end up doing this that seems to be working now and actually installing rails, after pulling ears, hairs and Seinfeld season 8 to stop me from killing myself and others (The whole season!!)

sudo rvm get stable --auto-dotfiles --rails

And now it stuck at installing documentation for rails 4.1.4. so I suppose it does work yay! I think I just need to stop or watch more seinfelds or veeps and get back later and if its still not done I will just restart the thing.

Wish me luck! Hope the above could help others

Ben Anggoro
Ben Anggoro
36,161 Points

Yes it works!! Yay! Now I'm just gonna back to Hampton's course because as he said, he's so handsome... & important lol

Ben Anggoro
Ben Anggoro
36,161 Points

Yet another additional notes, still getting errors with mysql after that. Just in case anyone ever dealing with the same issue - can't connect to database / cant even start mysql server, the answer is

Found this on stack overflow

unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp