Post OS X 10.10 Yosemite install Rails error - ruby-on-rails

I did a clean install of Mac OS Yosemite, but now Rails won't work properly.
When I try to do rails s it tells me to do bundle install.
I get this message after trying to run bundle install:
Errno::EACCES: Permission denied - /Users/giowong/rails_project/doctible_pre_treatment/vendor/bundle/ruby/2.0.0/gems/bcrypt-3.1.7/.gitignore
I did
sudo gem update --system
and
bundle install
When I do this, I'm getting this nasty stuff:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20141107-39214-1ds3j4x.rb extconf.rb
checking for ruby/util.h... *** 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:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:549:in `block in try_compile'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:502:in `with_werror'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:549:in `try_compile'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:1044:in `block in have_header'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:895:in `block in checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:340:in `block in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:336:in `postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:894:in `checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:1043:in `have_header'
from extconf.rb:14:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/giowong/rails_project/doctible_pre_treatment/vendor/bundle/ruby/2.0.0/gems/bcrypt-3.1.7 for inspection.
Results logged to /Users/giowong/rails_project/doctible_pre_treatment/vendor/bundle/ruby/2.0.0/extensions/universal-darwin-14/2.0.0/bcrypt-3.1.7/gem_make.out
An error occurred while installing bcrypt (3.1.7), and Bundler cannot continue.
Make sure that `gem install bcrypt -v '3.1.7'` succeeds before bundling.
I've tried installing using
\curl -sSL https://get.rvm.io | bash -s stable --rails
but no luck.

I don't recommend using the default Ruby provided with OS X, so install RVM instead. You will also need to install the Xcode command line tools:
xcode-select --install # click install, not Get Xcode
Then verify if gcc is installed:
gcc --version
And only then run:
\curl -sSL https://get.rvm.io | bash -s stable --rails

Related

Ruby-on-Rails. Problem with therubyracer (0.12.3)

I try to execute
bundle i
I get an error message:
An error occurred while installing therubyracer (0.12.3), and Bundler cannot continue.
Make sure that gem install therubyracer -v '0.12.3' succeeds before bundling.
I try:
$ gem uninstall libv8
$ gem install therubyracer
And:
gem list libv8 --remote --all
gem install libv8 -v 3.16.14.19 -- --with-system-v8
gem install therubyracer -- --with-v8-dir=/Users/MY_NAME/homebrew/opt/v8#3.15
Don't work.
I have result file gem_make.out:
current directory: /Users/MY_NAME/.rvm/gems/ruby-2.5.1/gems/therubyracer-0.12.3/ext/v8
/Users/MY_NAME/.rvm/rubies/ruby-2.5.1/bin/ruby -I /Users/MY_NAME/.rvm/rubies/ruby-
2.5.1/lib/ruby/site_ruby/2.5.0 -r ./siteconf20200814-13680-i9h23c.rb extconf.rb --with-v8-
dir\=/Users/MY_NAME/homebrew/opt/v8#3.15
checking for -lpthread... *** 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:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/MY_NAME/.rvm/rubies/ruby-2.5.1/bin/$(RUBY_BASE_NAME)
--with-pthreadlib
--without-pthreadlib
/Users/MY_NAME/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/MY_NAME/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/mkmf.rb:541:in `try_link0'
from /Users/MY_NAME/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/mkmf.rb:559:in `try_link'
from /Users/MY_NAME/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/mkmf.rb:777:in `try_func'
from /Users/MY_NAME/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/mkmf.rb:1004:in `block in have_library'
from /Users/MY_NAME/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/mkmf.rb:947:in `block in checking_for'
from /Users/MY_NAME/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/mkmf.rb:350:in `block (2 levels) in postpone'
from /Users/MY_NAME/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/mkmf.rb:320:in `open'
from /Users/MY_NAME/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/mkmf.rb:350:in `block in postpone'
from /Users/MY_NAME/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/mkmf.rb:320:in `open'
from /Users/MY_NAME/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/mkmf.rb:346:in `postpone'
from /Users/MY_NAME/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/mkmf.rb:946:in `checking_for'
from /Users/MY_NAME/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/mkmf.rb:999:in `have_library'
from extconf.rb:3:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/MY_NAME/.rvm/gems/ruby-2.5.1/extensions/x86_64-darwin-17/2.5.0/therubyracer- 0.12.3/mkmf.log
extconf failed, exit code 1
It was helpful for me:
brew install ruby
brew upgrade ruby
xcode-select --install

An error occurred while installing nio4r (1.2.1), and Bundler cannot continue

Hi I'm working on putting my website to digital ocean. But when in the process when i Bundle install i get this error
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-2.2.4/bin/ruby -r ./siteconf20161001-6508-ukh5t9.rb extconf.rb --with-cflags=-std=c99
checking for unistd.h... *** 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:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/rvm/rubies/ruby-2.2.4/bin/$(RUBY_BASE_NAME)
/usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:587:in `try_cpp'
from /usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:1060:in `block in have_header'
from /usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:911:in `block in checking_for'
from /usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:321:in `open'
from /usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:351:in `block in postpone'
from /usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:321:in `open'
from /usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:347:in `postpone'
from /usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:910:in `checking_for'
from /usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:1059:in `have_header'
from extconf.rb:3:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.2.4/gems/nio4r-1.2.1 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.2.4/extensions/x86_64-linux/2.2.0/nio4r-1.2.1/gem_make.out
An error occurred while installing nio4r (1.2.1), and Bundler cannot continue.
Make sure that `gem install nio4r -v '1.2.1'` succeeds before bundling.
I'm using Putty.exe to configure it following the tutorial https://www.digitalocean.com/community/tutorials/how-to-use-the-ruby-on-rails-one-click-application-on-digitalocean
I'm using Ruby ruby 2.2.4p230
Rails 5.0.0.1
Not sure if this help. When i using Putty.exe to configure my website the tutorial said If your Gemfile specifies a version of Ruby that is different from the one installed on the system, you may install it using RVM. So I tried:
rvm install 2.2.4
rvm use ruby-2.2.4-p230 --default
But I get the error ruby-2.2.4-p230 is not installed. And it can't installed because the system cannot find the specific version. So I use
rvm use ruby-2.2.4
sudo apt-get install build-essential
worked for me

Not able to install gems "mysql2, mariadb 10.1" in Ubuntu 16.04 Xenial

I have working mariadb 10.1 server.
I install ruby 2.3.0 on ubuntu 16.04.
I install libmariadbd-dev and libmariadbclient-dev.
When I try "gem install mysql2", then a recive message:
Building native extensions with: '--with-mysql-dir=/usr/local/mysql'
This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/mysql2-0.4.4/ext/mysql2
/usr/bin/ruby2.3 -r ./siteconf20160615-5183-kj9yds.rb extconf.rb --with-mysql-dir=/usr/local/mysql
checking for ruby/thread.h... *** 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:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/$(RUBY_BASE_NAME)2.3
/usr/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/lib/ruby/2.3.0/mkmf.rb:587:in `try_cpp'
from /usr/lib/ruby/2.3.0/mkmf.rb:1091:in `block in have_header'
from /usr/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
from /usr/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone'
from /usr/lib/ruby/2.3.0/mkmf.rb:320:in `open'
from /usr/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
from /usr/lib/ruby/2.3.0/mkmf.rb:320:in `open'
from /usr/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
from /usr/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
from /usr/lib/ruby/2.3.0/mkmf.rb:1090:in `have_header'
from extconf.rb:16:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/mysql2-0.4.4/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.3.0/gems/mysql2-0.4.4 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/mysql2-0.4.4/gem_make.out
And I can`t find how to build this gem.
Gem in this situation need 3 packets.
sudo apt-get install libnetcdf-dev libssl-dev libcrypto++-dev
This is for mac but you need to change the path:
gem uninstall mysql2
intall mariadb 10.1 andnecesaary ssl packages or maybe this are not needed
then check the path to the libraries and the tinal folders have the same name:
bundle config --local build.mysql2 "--with-mysql-config=/usr/local/Cellar/mariadb#10.1/10.1.29/bin/mysql_config --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include"
or without the ssl path
bundle config --local build.mysql2 "--with-mysql-config=/usr/local/Cellar/mariadb#10.1/10.1.29/bin/mysql_config
or directly the gem, but if you come ffrom mysql is better to do it with bundle
gem install mysql2 -v 'x.y.z' -- --with-mysql-config=/usr/local/Cellar/mariadb#10.1/10.1.29/bin/mysql_config
and finally
bundle install

Error Installing Gem 'devise' ruby on rails

I'm working on my first ruby on rails course, building an application. Below is the error I am getting in the terminal when running the bundle install command. I am trying to add the gem 'devise'. I have no idea how to get past this error. Thanks!
Installing bcrypt (3.1.7) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for ruby/util.h... *** 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:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby
/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:931:in `block in have_header'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:930:in `have_header'
from extconf.rb:14:in `<main>'
Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p194/gems/bcrypt-3.1.7 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p194/gems/bcrypt-3.1.7/ext/mri/gem_make.out
An error occured while installing bcrypt (3.1.7), and Bundler cannot continue.
Make sure that `gem install bcrypt -v '3.1.7'` succeeds before bundling.
you missing gcc if you use homebrew
brew tap homebrew/dupes
then
brew install apple-gcc42
on linux centos/fedora:
yum install gcc
on linux ubuntu:
apt-get install build-essential
Please update if it helps you.

Error installing cocoapods, even though i installed development tools

Ive encounterd error installing cocoapods. Im using OSX 10.9.2.
I got the error to install development tools first, So ive installed it, tried to install again and had the same error, tried also to reboot, still no help.
Any ideas? :)
sudo gem install cocoapods
Password:
/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/gem:4: warning: Insecure world writable dir /usr/local/rvm/gems/ruby-1.9.3-p194/bin in PATH, mode 042777
Building native extensions. This could take a while...
ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.
"/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby" -rubygems /usr/local/rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/bin/rake RUBYARCHDIR=/usr/local/rvm/gems/ruby-1.9.3-p194/gems/xcodeproj-0.16.0/ext RUBYLIBDIR=/usr/local/rvm/gems/ruby-1.9.3-p194/gems/xcodeproj-0.16.0/ext
/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/rake/file_utils.rb:68: warning: Insecure world writable dir /usr/local/rvm/gems/ruby-1.9.3-p194/bin in PATH, mode 042777
checking for -std=c99 option to compiler... *** 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:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby
/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:491:in `block in try_compile'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:443:in `with_werror'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:491:in `try_compile'
from extconf.rb:24:in `block in <main>'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from extconf.rb:23:in `<main>'
rake aborted!
Command failed with status (1): [/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/...]
Tasks: TOP => default => ext
(See full trace by running task with --trace)
Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p194/gems/xcodeproj-0.16.0 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p194/gems/xcodeproj-0.16.0/ext/xcodeproj/gem_make.out
If you don't yet have it, get homebrew by running:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Then install cocoapods using homebrew:
brew install cocoapods

Resources