Alan_
Alan_

Reputation: 91

Problem with bundler using rails (mac user)

when i try to run my app, i get this errors:

Could not find racc-1.5.2 in any of the sources
Run `bundle install` to install missing gems.

I run:

$ bundle install

response:

Your user account isn't allowed to install to the system RubyGems.
  You can cancel this installation and run:

      bundle config set --local path 'vendor/bundle'
      bundle install

$ type password two times (system ask twice)

response:

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

    current directory: /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-861puoracc-1.5.2/gems/racc-1.5.2/ext/racc/cparse
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /Library/Ruby/Site/2.6.0 -r ./siteconf20210303-5388-1sxj4i7.rb extconf.rb
checking for rb_ary_subseq()... *** 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.6/usr/bin/$(RUBY_BASE_NAME)
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467: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.6/usr/lib/ruby/2.6.0/mkmf.rb:546:in `block in try_link0'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/tmpdir.rb:93:in `mktmpdir'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:543:in `try_link0'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:570:in `try_link'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:782:in `try_func'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1069:in `block in have_func'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:959:in `block in checking_for'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in `block (2 levels) in postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in `open'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in `block in postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in `open'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:357:in `postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:958:in `checking_for'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1068:in `have_func'
    from extconf.rb:6:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-861puoracc-1.5.2/extensions/universal-darwin-20/2.6.0/racc-1.5.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-861puoracc-1.5.2/gems/racc-1.5.2 for inspection.
Results logged to
/var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-861puoracc-1.5.2/extensions/universal-darwin-20/2.6.0/racc-1.5.2/gem_make.out

An error occurred while installing racc (1.5.2), and Bundler cannot continue.
Make sure that `gem install racc -v '1.5.2' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  rails was resolved to 6.1.3, which depends on
    actioncable was resolved to 6.1.3, which depends on
      actionpack was resolved to 6.1.3, which depends on
        actionview was resolved to 6.1.3, which depends on
          rails-dom-testing was resolved to 2.0.3, which depends on
            nokogiri was resolved to 1.11.1, which depends on
              racc


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

    current directory: /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-5s57nvnio4r-2.5.5/gems/nio4r-2.5.5/ext/nio4r
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /Library/Ruby/Site/2.6.0 -r ./siteconf20210303-5388-1yywys0.rb extconf.rb
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=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME)
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467: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.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in `block in try_compile'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:534:in `with_werror'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in `try_compile'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1109:in `block in have_header'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:959:in `block in checking_for'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in `block (2 levels) in postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in `open'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in `block in postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in `open'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:357:in `postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:958:in `checking_for'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1108:in `have_header'
    from extconf.rb:15:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-5s57nvnio4r-2.5.5/extensions/universal-darwin-20/2.6.0/nio4r-2.5.5/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-5s57nvnio4r-2.5.5/gems/nio4r-2.5.5 for
inspection.
Results logged to
/var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-5s57nvnio4r-2.5.5/extensions/universal-darwin-20/2.6.0/nio4r-2.5.5/gem_make.out

An error occurred while installing nio4r (2.5.5), and Bundler cannot continue.
Make sure that `gem install nio4r -v '2.5.5' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  rails was resolved to 6.1.3, which depends on
    actioncable was resolved to 6.1.3, which depends on
      nio4r


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

    current directory: /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-4k1ekzbcrypt-3.1.16/gems/bcrypt-3.1.16/ext/mri
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /Library/Ruby/Site/2.6.0 -r ./siteconf20210303-5388-1xu8ddx.rb extconf.rb
creating Makefile

current directory: /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-4k1ekzbcrypt-3.1.16/gems/bcrypt-3.1.16/ext/mri
make DESTDIR\= clean

current directory: /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-4k1ekzbcrypt-3.1.16/gems/bcrypt-3.1.16/ext/mri
make DESTDIR\=
make: *** No rule to make target
`/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin20/ruby/config.h',
needed by `bcrypt_ext.o'.  Stop.

make failed, exit code 2

Gem files will remain installed in /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-4k1ekzbcrypt-3.1.16/gems/bcrypt-3.1.16 for
inspection.
Results logged to
/var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-4k1ekzbcrypt-3.1.16/extensions/universal-darwin-20/2.6.0/bcrypt-3.1.16/gem_make.out

An error occurred while installing bcrypt (3.1.16), and Bundler cannot continue.
Make sure that `gem install bcrypt -v '3.1.16' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  devise was resolved to 4.7.3, which depends on
    bcrypt


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

    current directory: /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-z8an9bbindex-0.8.1/gems/bindex-0.8.1/ext/skiptrace
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /Library/Ruby/Site/2.6.0 -r ./siteconf20210303-5388-1k62vcs.rb extconf.rb
creating Makefile

current directory: /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-z8an9bbindex-0.8.1/gems/bindex-0.8.1/ext/skiptrace
make DESTDIR\= clean

current directory: /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-z8an9bbindex-0.8.1/gems/bindex-0.8.1/ext/skiptrace
make DESTDIR\=
make: *** No rule to make target
`/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin20/ruby/config.h',
needed by `cruby.o'.  Stop.

make failed, exit code 2

Gem files will remain installed in /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-z8an9bbindex-0.8.1/gems/bindex-0.8.1 for
inspection.
Results logged to
/var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-z8an9bbindex-0.8.1/extensions/universal-darwin-20/2.6.0/bindex-0.8.1/gem_make.out

An error occurred while installing bindex (0.8.1), and Bundler cannot continue.
Make sure that `gem install bindex -v '0.8.1' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  web-console was resolved to 4.1.0, which depends on
    bindex


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

    current directory: /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-tk45tbmsgpack-1.4.2/gems/msgpack-1.4.2/ext/msgpack
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /Library/Ruby/Site/2.6.0 -r ./siteconf20210303-5388-5tsgu7.rb extconf.rb
checking for ruby/st.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.6/usr/bin/$(RUBY_BASE_NAME)
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467: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.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in `block in try_compile'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:534:in `with_werror'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in `try_compile'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1109:in `block in have_header'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:959:in `block in checking_for'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in `block (2 levels) in postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in `open'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in `block in postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in `open'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:357:in `postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:958:in `checking_for'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1108:in `have_header'
    from extconf.rb:3:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-tk45tbmsgpack-1.4.2/extensions/universal-darwin-20/2.6.0/msgpack-1.4.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-tk45tbmsgpack-1.4.2/gems/msgpack-1.4.2 for
inspection.
Results logged to
/var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-tk45tbmsgpack-1.4.2/extensions/universal-darwin-20/2.6.0/msgpack-1.4.2/gem_make.out

An error occurred while installing msgpack (1.4.2), and Bundler cannot continue.
Make sure that `gem install msgpack -v '1.4.2' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  bootsnap was resolved to 1.7.2, which depends on
    msgpack


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

    current directory: /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-pjciubbyebug-11.1.3/gems/byebug-11.1.3/ext/byebug
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /Library/Ruby/Site/2.6.0 -r ./siteconf20210303-5388-18f31t0.rb extconf.rb
creating Makefile

current directory: /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-pjciubbyebug-11.1.3/gems/byebug-11.1.3/ext/byebug
make DESTDIR\= clean

current directory: /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-pjciubbyebug-11.1.3/gems/byebug-11.1.3/ext/byebug
make DESTDIR\=
make: *** No rule to make target
`/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin20/ruby/config.h',
needed by `breakpoint.o'.  Stop.

make failed, exit code 2

Gem files will remain installed in /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-pjciubbyebug-11.1.3/gems/byebug-11.1.3 for
inspection.
Results logged to
/var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-pjciubbyebug-11.1.3/extensions/universal-darwin-20/2.6.0/byebug-11.1.3/gem_make.out

An error occurred while installing byebug (11.1.3), and Bundler cannot continue.
Make sure that `gem install byebug -v '11.1.3' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  byebug

Info:

ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]

Bundler version 2.2.12 (2021-03-01 commit 1de3f8de73)(this is when i start having problems)

rails -v
Rails 6.1.3

Upvotes: 9

Views: 8986

Answers (5)

stiemannkj1
stiemannkj1

Reputation: 4549

To fix this, I had to add the following environment variables to my ~/.profile/~/.bash_profile:

export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
export LIBRARY_PATH="/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib"

Once I added those, I was able to install the racc Gem.

Note that you may need to install/setup the Xcode SDK/libraries first via:

xcode-select --install
sudo xcodebuild -license
sudo xcode-select --switch /Applications/Xcode.app

Upvotes: 0

roqkabel
roqkabel

Reputation: 31

Try installing with

sudo gem install package_name

and then again run

bundle install 

Upvotes: -1

Divyansh Jain
Divyansh Jain

Reputation: 378

Make sure you've granted developer tools access to Terminal, without it no matter how many times you do xcode-select --install it won't workenter image description here

Upvotes: 3

zapcaz
zapcaz

Reputation: 61

Had this problem myself. You just need to update the CommandLineTools for Mac.

Ran this code in my root fixed it:

xcode-select --install

Upvotes: 4

mcfinnigan
mcfinnigan

Reputation: 11638

You are most likely missing the ruby-dev source libraries. You also are most likely using the system-provided ruby rather than one installed in your own home directory.

I strongly recommend you install rvm or rbenv and use either of these to configure your system.

Here are some pretty complete MacOS installation instructions for installing and configuring a ruby 2.7.1 development environment.

https://gist.github.com/mcls/3118518

Upvotes: -2

Related Questions