Issues Installing Dotfiles

After having some trouble and getting “rbenv: command not found” every time I opened terminal, I was able to re-install the dotfiles and apparently have installed rbenv. However, on while installing the dotfiles the second time, I got the error

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

current directory:
/Users/Dieter/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/pg-0.21.0/ext
/Users/Dieter/.rbenv/versions/2.3.1/bin/ruby -r
./siteconf20171211-45253-1v2oj18.rb extconf.rb
checking for pg_config… no
No pg_config… trying anyway. If building fails, please try again with
–with-pg-config=/path/to/pg_config
checking for libpq-fe.h… no
Can’t find the 'libpq-fe.h header
*** 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/Dieter/.rbenv/versions/2.3.1/bin/$(RUBY_BASE_NAME)
–with-pg
–without-pg
–enable-windows-cross
–disable-windows-cross
–with-pg-config
–without-pg-config
–with-pg_config
–without-pg_config
–with-pg-dir
–without-pg-dir
–with-pg-include
–without-pg-include=${pg-dir}/include
–with-pg-lib
–without-pg-lib=${pg-dir}/lib

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

/Users/Dieter/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-15/2.3.0-static/pg-0.21.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in
/Users/Dieter/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/pg-0.21.0 for
inspection.
Results logged to
/Users/Dieter/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-15/2.3.0-static/pg-0.21.0/gem_make.out

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

When I check the mkmf.log like it says, I get:

-bash: /Users/Dieter/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-15/2.3.0-static/pg-0.21.0/mkmf.log: Permission denied

Can you make sure the Xcode command line tools are installed? See this README: https://github.com/appacademy/dotfiles

Make sure that succeeds, close and reopen a terminal window, and let me know if you’re still getting this error. Good luck!

Xcode returns that it’s already installed. I was able to bundle install, but then after trying bundle exec rspec, I get

An error occurred while loading ./spec/methods_spec.rb.
Failure/Error: load file

SyntaxError:
/Users/Dieter/Downloads/appacademy-online-methods-exercises-4c67d098a594/lib/methods.rb:118: syntax error, unexpected end-of-input

bundle info rspec returns:

  • rspec (3.7.0)
    Summary: rspec-3.7.0
    Homepage: http://github.com/rspec
    Path: /Users/Dieter/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-3.7.0

Ah, this is a good error! This means the problem is with your code, not your system setup. We can see that this is a syntax error that is being raised at line 118 of methods.rb. That means that somewhere in your file, you’ve likely missed an end or forgotten to finish a statement. Take a look at your code and see if you can spot it; if you haven’t found it on your own after 10 minutes, share your code here and we can find it together.

Ahh, that makes sense, thank you!

One more thing, though… It seems totally unrelated, but in atom, I get a constant error running RuboCop. The log error is

/Users/Dieter/.atom/packages/linter/lib/linter-registry.js:159 [Linter] Error running RuboCop Error: Failed to spawn command rubocop. Make sure rubocop is installed and on your PATH
at /Users/Dieter/.atom/packages/linter-rubocop/node_modules/atom-linter/lib/helpers.js:130:24
at process._tickCallback (internal/process/next_tick.js:103:7)
(anonymous) @ /Users/Dieter/.atom/packages/linter/lib/linter-registry.js:159

How do I make sure it’s installed and on my PATH?

Hey Charlie,

Can you first make sure RuboCop is installed by running gem install rubocop and see if the problem persists? Thanks!

David

Hi David,

When I try that, I get

usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
[-o owner] file1 file2
install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
[-o owner] file1 … fileN directory
install -d [-v] [-g group] [-m mode] [-o owner] directory …

Looks like you may just be typing install rubocop. Can you make sure the statement your putting in terminal reads as follows?

gem install rubocop

Let me know if this was the issue!

Yeah that was the issue. Thanks!