System can't find rubygems after editing .bashrc file

16 views
Skip to first unread message

Jesse Waites

unread,
Mar 9, 2017, 1:14:23 PM3/9/17
to boston-rubygroup
Hi all,

I have gotten myself into a bit of a pickle. Yesterday, I decided to change my zsh prompt around so I started editing my ~/.zshrc and ~/..bashrc files. I was then unable to start my rails console  - I get the error "Could not find activerecord-3.2.17 in any of the sources". I get the same error when asking the system 'rails -v'

I used rbenv, and rbenv function do still work.

This StackOverflow question and answer leads me to believe that my system no longer knows the path to my rubygems: http://stackoverflow.com/a/2383685

Following that, the output for 'gem environment' is:

$ gem environment 

=>

RubyGems Environment:
  - RUBYGEMS VERSION: 2.6.8
  - RUBY VERSION: 2.4.0 (2016-12-24 patchlevel 0) [x86_64-darwin16]
  - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.4.0
  - USER INSTALLATION DIRECTORY: /Users/enpro/.gem/ruby/2.4.0
  - RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - SPEC CACHE DIRECTORY: /Users/enpro/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/2.4.0/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-16
  - GEM PATHS:
     - /usr/local/lib/ruby/gems/2.4.0
     - /Users/enpro/.gem/ruby/2.4.0
     - /usr/local/Cellar/ruby/2.4.0/lib/ruby/gems/2.4.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
  - SHELL PATH:
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin

I have edited my bash_profile, trying each of the paths in GEM PATHS with no success.

Example:

export PS1="\u@\h\w $ "
export PATH="$HOME/.rbenv/bin:$PATH"
export GEM_PATH=/usr/local/Cellar/ruby/2.4.0/lib/ruby/gems/2.4.0:${GEM_PATH}
eval "$(rbenv init -)"

'bundle install' also blows up on me--- it tries but gets hung up on installing a specific gem which I suspect is an unrelated issue due to the bug reports / issues of that gem on github. This seems to be a path issue anyway, as things were working fine before I decided to be a hero and delete my bash profile.

I use rbenv if that is relevant.

Is there a way to either rebuild, revert, or fix this issue? I am running out of things to try here.



--
Jesse Waites
Web Developer

Peter Cai

unread,
Mar 9, 2017, 1:20:24 PM3/9/17
to boston-r...@googlegroups.com
Just a shot in the dark, but are you running zsh as a login shell? Otherwise I think it won't pick up your config settings.

Peter Cai | Privy Engineering

--
You received this message because you are subscribed to the Google Groups "Boston Ruby Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to boston-rubygroup+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jesse Waites

unread,
Mar 9, 2017, 1:32:50 PM3/9/17
to boston-rubygroup
Looks like that was the issue. I ran 'exec bash' and it switched over and picked up my changes. Thank you, Peter!

Reply all
Reply to author
Forward
0 new messages