I seem to be constantly having problems with getting the gems in the right place (and not needing to use sudo
when installing them.)
To address the sudo
issue, I installed rbenv
and then use that to install ruby 2.1.0 so that I had a separate one from Mac OSX system.
Then I installed bundler. But when I install gems from a Gemfile with bundler, I cannot find them.
Between all the steps I have taken, such as adding lines to my .bash_profile and so forth, I have the following, but really just want a clear, straightforward way to manage gems and their local execution:
gem env
:
Edit: I removed everything and reset PATH -- still didn't fix anything, but you can see that gems are installed in one directory but when I call the executable, the command cannot be found:
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.14
- RUBY VERSION: 2.0.0 (2014-02-24 patchlevel 451) [universal.x86_64-darwin13]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.0.0
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-13
- GEM PATHS:
- /Library/Ruby/Gems/2.0.0
- /Users/fongster/.gem/ruby/2.0.0
- /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0
Here is what happens when I want to run, say shotgun
:
bash-3.2$ shotgun
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:296:in
to_specs': Could not find 'shotgun' (>= 0) among 12 total gem(s) (Gem::LoadError)
Can someone point me to simple, straightforward directdions for ruby gem management on OSX so that:
- I don't need to use
sudo
to install gems - I can use bundler to install from a Gemfile for a given project
- Those gems and their executables (shotgun, restclient, sass) can just be executed
- My local environment based on this set up 'just works' in heroku?
- I don't need to type
bundle exec
when I need to do stuff
Also some clarity on whether I need to always go to a bash shell (currently, I have been using exec bash
to get my shell working).
EDIT: Following the steps below and have this response upon bundle:
Errno::EEXIST: File exists @ dir_s_mkdir - /Users/fongster/.rbenv/shims/gem
An error occurred while installing backports (3.6.3), and Bundler cannot
continue.
Make sure that `gem install backports -v '3.6.3'` succeeds before bundling.