Error after calling bundle install (Ruby on Rails installation) (Mac OS X)

I am trying to initialize a rails application, and I am running into some issues. When running: rails new . -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb

I run into the issue:

Could not find gem 'quiet_assets (>= 0) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.

When I try to run bundle install, it gives me this error:

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.

When I run that command, I get:

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

Running

sudo apt-get install mysql-server
sudo apt-get install mysql-client

I get the error: apt-get: command not found

Any ideas? I have full output below (from where the problems start, where composer tries to install the bundle of gems):

composer Installing gems. This will take a while.
         run bundle install --without production from "."
Fetching gem metadata from https://rubygems.org/........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 10.3.2
Using i18n 0.6.11
Using json 1.8.1
Using minitest 5.4.0
Using thread_safe 0.3.4
Using tzinfo 1.2.1
Using activesupport 4.1.4
Using builder 3.2.2
Using erubis 2.7.0
Using actionview 4.1.4
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.1.4
Using mime-types 1.25.1
Using polyglot 0.3.5
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 4.1.4
Using activemodel 4.1.4
Using arel 5.0.1.20140414130214
Using activerecord 4.1.4
Using addressable 2.3.6
Using bcrypt 3.1.7
Using coderay 1.1.0
Using better_errors 1.1.0
Using debug_inspector 0.0.2
Using binding_of_caller 0.7.2
Using sass 3.2.19
Using bootstrap-sass 3.2.0.1
Using bundler 1.6.2
Using colorize 0.7.3
Using net-ssh 2.9.1
Using net-scp 1.2.1
Using sshkit 1.5.1
Using capistrano 3.0.1
Using capistrano-bundler 1.1.2
Using capistrano-rails 1.1.0
Using capistrano-rails-console 0.2.0
Using capistrano-rvm 0.1.1
Using mini_portile 0.6.0
Using nokogiri 1.6.3.1
Using xpath 2.0.0
Using capybara 2.4.1
Using timers 1.1.0
Using celluloid 0.15.2
Using ffi 1.9.3
Using childprocess 0.5.3
Using coffee-script-source 1.7.1
Using execjs 2.2.1
Using coffee-script 2.3.0
Using thor 0.19.1
Using railties 4.1.4
Using coffee-rails 4.0.1
Using database_cleaner 1.3.0
Using orm_adapter 0.5.0
Using warden 1.2.3
Using devise 3.2.4
Using diff-lcs 1.2.5
Using factory_girl 4.4.0
Using factory_girl_rails 4.4.1
Using faker 1.4.2
Using hike 1.2.3
Using multi_json 1.10.1
Using tilt 1.4.1
Using sprockets 2.11.0
Using sprockets-rails 2.1.3
Using rails 4.1.4
Using figaro 1.0.0.rc1
Using formatador 0.2.5
Using rb-fsevent 0.9.4
Using rb-inotify 0.9.5
Using listen 2.7.9
Using lumberjack 1.0.9
Using method_source 0.8.2
Using slop 3.6.0
Using pry 0.10.0
Using guard 2.6.1
Using guard-bundler 2.0.0
Using guard-rails 0.5.3
Using rspec-support 3.0.3
Using rspec-core 3.0.3
Using rspec-expectations 3.0.3
Using rspec-mocks 3.0.3
Using rspec 3.0.0
Using guard-rspec 4.3.1
Using haml 4.1.0.beta.1
Using sexp_processor 4.4.3
Using ruby_parser 3.1.3
Using haml2slim 0.4.7
Using high_voltage 2.2.1
Using hpricot 0.8.6
Using html2haml 1.0.1
Using hub 1.12.2
Using interception 0.5
Using jbuilder 2.1.3
Using jquery-rails 3.1.1
Using launchy 2.4.2

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/**********/.rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
*** 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=/Users/*********/.rvm/rubies/ruby-2.1.2/bin/    ruby
--with-mysql-    dir
--without-mysql-    dir
--with-mysql-    include
--without-mysql-include=${mysql-dir}/    include
--with-mysql-    lib
--without-mysql-lib=${mysql-dir}/    lib
--with-mysql-    config
--without-mysql-    config
--with-mysql-    dir
--without-mysql-    dir
--with-mysql-    include
--without-mysql-include=${mysql-dir}/    include
--with-mysql-    lib
--without-mysql-lib=${mysql-dir}/    lib
--with-    mysqlclientlib
--without-    mysqlclientlib
--with-    mlib
--without-    mlib
--with-    mysqlclientlib
--without-    mysqlclientlib
--with-    zlib
--without-    zlib
--with-    mysqlclientlib
--without-    mysqlclientlib
--with-    socketlib
--without-    socketlib
--with-    mysqlclientlib
--without-    mysqlclientlib
--with-    nsllib
--without-    nsllib
--with-    mysqlclientlib
--without-    mysqlclientlib
--with-    mygcclib
--without-    mygcclib
--with-    mysqlclientlib
--without-
mysqlclientlib
extconf failed, exit code 1

Gem files will remain installed in /Users/**********/.rvm/gems/ruby-2.1.2@myapp/gems/mysql2-0.3.16 for inspection.
Results logged to /Users/************/.rvm/gems/ruby-2.1.2@myapp/extensions/x86_64-darwin-13/2.1.0-static/mysql2-0.3.16/gem_make.out
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.
    composer Updating gem paths.
WARN: Unresolved specs during Gem::Specification.reset:
      minitest (~> 5.1)
      rake (>= 0.8.7)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
    composer Stage Two (running recipe 'stage_two' callbacks).
    composer importing html2haml and haml2slim conversion tools
locale
gems
gems recipe stage two
gems configuring database
remove config/database.      yml
create config/database.      yml
option Username for MySQL? (leave blank to use the app name) root
gsub config/database.      yml
option Password for MySQL user root? root
gsub config/database.        yml
gems set config/database.yml for username/password root/        root
gsub config/database.        yml
gsub config/database.        yml
gsub config/database.      yml
option Okay to drop all existing databases named myapp? 'No' will abort immediately! (y/n) n
https://raw.github.com/RailsApps/rails-composer/master/composer.rb:1256:in     `block in apply': aborted at user's request (RuntimeError)
from https://raw.github.com/RailsApps/rails-composer/master/composer.rb:2127:in `call    '
from https://raw.github.com/RailsApps/rails-composer/master/composer.rb:2127:in `block in apply'
    from https://raw.github.com/RailsApps/rails-composer/master/composer.rb:2127:in     `each'
from https://raw.github.com/RailsApps/rails-composer/master/composer.rb:2127:in `apply    '
from /Users/***********/.rvm/gems/ruby-2.1.2@myapp/gems/thor-0.19.1/lib/thor/actions.rb:223:in `instance_eval'
    from /Users/***********/.rvm/gems/ruby-2.1.2@myapp/gems/thor-0.19.1/lib/thor/actions.rb:223:in     `apply'
from /Users/***********/.rvm/gems/ruby-2.1.2@myapp/gems/railties-4.1.4/lib/rails/generators/app_base.rb:144:in `apply_rails_template    '
from (eval):1:in `apply_rails_template'
    from /Users/***********/.rvm/gems/ruby-2.1.2@myapp/gems/thor-0.19.1/lib/thor/command.rb:27:in     `run'
from /Users/***********/.rvm/gems/ruby-2.1.2@myapp/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command    '
from /Users/***********/.rvm/gems/ruby-2.1.2@myapp/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `block in invoke_all'
    from /Users/***********/.rvm/gems/ruby-2.1.2@myapp/gems/thor-0.19.1/lib/thor/invocation.rb:133:in     `each'
from /Users/************/.rvm/gems/ruby-2.1.2@myapp/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `map    '
from /Users/*************/.rvm/gems/ruby-2.1.2@myapp/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `invoke_all'
    from /Users/*************/.rvm/gems/ruby-2.1.2@myapp/gems/thor-0.19.1/lib/thor/group.rb:232:in     `dispatch'
from /Users/*************/.rvm/gems/ruby-2.1.2@myapp/gems/thor-0.19.1/lib/thor/base.rb:440:in `start    '
from /Users/*************/.rvm/gems/ruby-2.1.2@myapp/gems/railties-4.1.4/lib/rails/commands/application.rb:17:in `<top (required)>'
    from /Users/*************/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in     `require'
from /Users/*************/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require    '
from /Users/*************/.rvm/gems/ruby-2.1.2@myapp/gems/railties-4.1.4/lib/rails/cli.rb:14:in `<top (required)>'
    from /Users/*************/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in     `require'
from /Users/*************/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require    '
from /Users/*************/.rvm/gems/ruby-2.1.2@myapp/gems/railties-4.1.4/bin/rails:9:in `<top (required)>'
    from /Users/************/.rvm/gems/ruby-2.1.2@myapp/bin/rails:23:in     `load'
from /Users/***********/.rvm/gems/ruby-2.1.2@myapp/bin/rails:23:in `<main>    '
from /Users/***********/.rvm/gems/ruby-2.1.2@myapp/bin/ruby_executable_hooks:15:in `eval'
    from /Users/***********/.rvm/gems/ruby-2.1.2@myapp/bin/ruby_executable_hooks:15:in `<main>'
:myapp ***********$ An error occurred while installing mysql2 (0.3.16), and Bundler cannot continue.
-bash: syntax error near unexpected token `('
:myapp ***********$ rails new . -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb
Could not find gem 'quiet_assets (>= 0) ruby
' in the gems available on this machine.
Run `bundle install` to install missing gems.
:myapp ***********$ bundle install
Fetching gem metadata from https://rubygems.org/........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 10.3.2
Using i18n 0.6.11
Using json 1.8.1
Using minitest 5.4.0
Using thread_safe 0.3.4
Using tzinfo 1.2.1
Using activesupport 4.1.4
Using builder 3.2.2
Using erubis 2.7.0
Using actionview 4.1.4
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.1.4
Using mime-types 1.25.1
Using polyglot 0.3.5
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 4.1.4
Using activemodel 4.1.4
Using arel 5.0.1.20140414130214
Using activerecord 4.1.4
Using addressable 2.3.6
Using bcrypt 3.1.7
Using coderay 1.1.0
Using better_errors 1.1.0
Using debug_inspector 0.0.2
Using binding_of_caller 0.7.2
Using sass 3.2.19
Using bootstrap-sass 3.2.0.1
Using bundler 1.6.2
Using colorize 0.7.3
Using net-ssh 2.9.1
Using net-scp 1.2.1
Using sshkit 1.5.1
Using capistrano 3.0.1
Using capistrano-bundler 1.1.2
Using capistrano-rails 1.1.0
Using capistrano-rails-console 0.2.0
Using capistrano-rvm 0.1.1
Using mini_portile 0.6.0
Using nokogiri 1.6.3.1
Using xpath 2.0.0
Using capybara 2.4.1
Using timers 1.1.0
Using celluloid 0.15.2
Using ffi 1.9.3
Using childprocess 0.5.3
Using coffee-script-source 1.7.1
Using execjs 2.2.1
Using coffee-script 2.3.0
Using thor 0.19.1
Using railties 4.1.4
Using coffee-rails 4.0.1
Using database_cleaner 1.3.0
Using orm_adapter 0.5.0
Using warden 1.2.3
Using devise 3.2.4
Using diff-lcs 1.2.5
Using factory_girl 4.4.0
Using factory_girl_rails 4.4.1
Using faker 1.4.2
Using hike 1.2.3
Using multi_json 1.10.1
Using tilt 1.4.1
Using sprockets 2.11.0
Using sprockets-rails 2.1.3
Using rails 4.1.4
Using figaro 1.0.0.rc1
Using formatador 0.2.5
Using rb-fsevent 0.9.4
Using rb-inotify 0.9.5
Using listen 2.7.9
Using lumberjack 1.0.9
Using method_source 0.8.2
Using slop 3.6.0
Using pry 0.10.0
Using guard 2.6.1
Using guard-bundler 2.0.0
Using guard-rails 0.5.3
Using rspec-support 3.0.3
Using rspec-core 3.0.3
Using rspec-expectations 3.0.3
Using rspec-mocks 3.0.3
Using rspec 3.0.0
Using guard-rspec 4.3.1
Using haml 4.1.0.beta.1
Using sexp_processor 4.4.3
Using ruby_parser 3.1.3
Using haml2slim 0.4.7
Using high_voltage 2.2.1
Using hpricot 0.8.6
Using html2haml 1.0.1
Using hub 1.12.2
Using interception 0.5
Using jbuilder 2.1.3
Using jquery-rails 3.1.1
Using launchy 2.4.2
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/*************/.rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
*** 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=/Users/***************/.rvm/rubies/ruby-2.1.2/bin/ruby
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-mysql-config
--without-mysql-config
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-mysqlclientlib
--without-mysqlclientlib
--with-mlib
--without-mlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-zlib
--without-zlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-socketlib
--without-socketlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-nsllib
--without-nsllib
--with-mysqlclientlib
--without-mysqlclientlib
--with-mygcclib
--without-mygcclib
--with-mysqlclientlib
--without-mysqlclientlib
extconf failed, exit code 1
Gem files will remain installed in /Users/***********/.rvm/gems/ruby-2.1.2@myapp/gems/mysql2-0.3.16 for inspection.
Results logged to /Users/***********/.rvm/gems/ruby-2.1.2@myapp/extensions/x86_64-darwin-13/2.1.0-static/mysql2-0.3.16/gem_make.out
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.
:myapp ***************$ gem install mysql2 -v '0.3.16    '
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/Users/************/.rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
*** 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=/Users/**************/.rvm/rubies/ruby-2.1.2/bin/ruby
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-mysql-config
--without-mysql-config
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-mysqlclientlib
--without-mysqlclientlib
--with-mlib
--without-mlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-zlib
--without-zlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-socketlib
--without-socketlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-nsllib
--without-nsllib
--with-mysqlclientlib
--without-mysqlclientlib
--with-mygcclib
--without-mygcclib
--with-mysqlclientlib
--without-mysqlclientlib
extconf failed, exit code 1
Gem files will remain installed in /Users/***********/.rvm/gems/ruby-2.1.2@myapp/gems/mysql2-0.3.16 for inspection.
Results logged to /Users/*************/.rvm/gems/ruby-2.1.2@myapp/extensions/x86_64-darwin-13/2.1.0-static/mysql2-0.3.16/gem_make.out

You probably have not installed everything that is necessary for building gem native extensions. What you need depends on which OS you are using. For example, on Ubuntu, I do

sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core \ zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev autoconf libc6-dev ncurses-dev automake \ libtool

Colin

I’m pretty sure I installed everything required. What could be missing on Mac OS X?

OSX doesn’t have apt-get. You should use brew instead,python - Why is the apt-get function not working in the terminal on Mac OS X v10.9 (Mavericks)? - Stack Overflow, but this can occasionally have different installation instructions. Make sure you are installing MySQL correctly for Mac.

You can’t install mysql2 gem (used for MySQL database) without installin MySQL database server.

To install it on OS X follow the steps as described here:

  • Check the MySQL installation is OK.

  • Run

bundle install

``

  • navigate to your RoR project in the terminal and run rails s

``