Command not found after installing gem - shell

After a version conflict I re-installed the middleman gem. It seems to have deleted the path as well which leads to the error
command not found: middleman
I am however not certain how to relink the command to the gem! Has anyone experienced a similar issue before and know what the best solution is to relink the two together?
Below my gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.7.7
- RUBY VERSION: 2.4.3 (2017-12-14 patchlevel 205) [x86_64-darwin17]
- INSTALLATION DIRECTORY: /Users/pimzonneveld/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0
- USER INSTALLATION DIRECTORY: /Users/pimzonneveld/.gem/ruby/2.4.0
- RUBY EXECUTABLE: /Users/pimzonneveld/.rbenv/versions/2.4.3/bin/ruby
- EXECUTABLE DIRECTORY: /Users/pimzonneveld/.rbenv/versions/2.4.3/bin
- SPEC CACHE DIRECTORY: /Users/pimzonneveld/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/pimzonneveld/.rbenv/versions/2.4.3/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-17
- GEM PATHS:
- /Users/pimzonneveld/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0
- /Users/pimzonneveld/.gem/ruby/2.4.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://gems.rubyforge.org/", "http://gems.github.com"]
- :benchmark => false
- "gem" => "--no-document"
- REMOTE SOURCES:
- http://gems.rubyforge.org/
- http://gems.github.com
- SHELL PATH:
- /Users/pimzonneveld/.rbenv/versions/2.4.3/bin
- /usr/local/Cellar/rbenv/1.1.1/libexec
- ./bin
- ./node_modules/.bin
- /Users/pimzonneveld/.rbenv/shims
- /Users/pimzonneveld/.rbenv/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /usr/local/sbin
Installed middleman gems
*** LOCAL GEMS ***
font-awesome-middleman (4.5.0)
jquery-middleman (3.1.2)
middleman (4.2.1)
middleman-autoprefixer (2.9.0)
middleman-blog (4.0.2)
middleman-cli (4.2.1)
middleman-core (4.2.1)
middleman-sprockets (4.1.1)

Related

unable to run gems using custom Ruby version on macOS Mojave

I get error when trying to run any gem installed using ruby from brew install ruby
Here is slather example but this is same for any gem I tried (Jekyll, CocoaPods, Nokogiri etc.)
/Library/Ruby/Site/2.3.0/rubygems.rb:275:in `find_spec_for_exe': can't find gem slather (>= 0.a) with executable slather (Gem::GemNotFoundException)
from /Library/Ruby/Site/2.3.0/rubygems.rb:252:in `bin_path'
from /usr/local/bin/slather:22:in `<main>'
gem is installed properly but for unknown reason ruby tries to use paths for system version.
I have read to not use rvm and rbenv and only brew version but this also do not work as above
ruby -v: ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin18]
gem env:
RubyGems Environment:
- RUBYGEMS VERSION: 3.1.2
- RUBY VERSION: 2.6.5 (2019-10-01 patchlevel 114) [x86_64-darwin18]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.6.0
- USER INSTALLATION DIRECTORY: /Users/[user]/.gem/ruby/2.6.0
- RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /usr/local/lib/ruby/gems/2.6.0/bin
- SPEC CACHE DIRECTORY: /Users/[user]/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/2.6.5/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-18
- GEM PATHS:
- /usr/local/lib/ruby/gems/2.6.0
- /Users/[user]/.gem/ruby/2.6.0
- /usr/local/Cellar/ruby/2.6.5/lib/ruby/gems/2.6.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/opt/ruby/bin
- /Users/[user]/.fastlane/bin
- /Users/[user]/.fastlane/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /opt/X11/bin
any help appreciated

cap deploy throws "Ruby version is 2.2.5, but your Gemfile specified 2.5.3", except my Ruby version is 2.5.3

Out of absolutely nowhere (not an exaggeration: I deployed two hours before this exception started happening), cap production deploy stopped working and is throwing this error:
Your Ruby version is 2.2.5, but your Gemfile specified 2.5.3
bundle stderr: Nothing written
Except I'm using 2.5.3, as specified in both gemfile and in .ruby-version.
This is what's in my gemfile:
source 'https://rubygems.org'
ruby '2.5.3'
I'm using rvm. ruby -v returns ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin18], and ruby is set to global. I've tried running gem update bundler, gem install bundler followed by bundle install, bundle, and deleted gemfile.lock.
$ bundle env
Bundler 1.17.1
Platforms ruby, x86_64-darwin-18
Ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin18]
Full Path /Users/mirai/.rvm/rubies/ruby-2.5.3/bin/ruby
Config Dir /Users/mirai/.rvm/rubies/ruby-2.5.3/etc
RubyGems 2.7.8
Gem Home /Users/mirai/.rvm/gems/ruby-2.5.3#greentea-b2b
Gem Path /Users/mirai/.rvm/gems/ruby-2.5.3#greentea-
b2b:/Users/mirai/.rvm/gems/ruby-2.5.3#global
User Path /Users/mirai/.gem/ruby/2.5.0
Bin Dir /Users/mirai/.rvm/gems/ruby-2.5.3#greentea-b2b/bin
$ which -a bundle
/Users/mirai/.rvm/rubies/ruby-2.5.3/bin/bundle
/usr/local/bin/bundle
Edit: Output of $ gem env:
RubyGems Environment:
- RUBYGEMS VERSION: 2.7.8
- RUBY VERSION: 2.5.3 (2018-10-18 patchlevel 105) [x86_64-darwin18]
- INSTALLATION DIRECTORY: /Users/mirai/.rvm/gems/ruby-2.5.3#mirai-b2b
- USER INSTALLATION DIRECTORY: /Users/mirai/.gem/ruby/2.5.0
- RUBY EXECUTABLE: /Users/mirai/.rvm/rubies/ruby-2.5.3/bin/ruby
- EXECUTABLE DIRECTORY: /Users/mirai/.rvm/gems/ruby-2.5.3#greentea-b2b/bin
- SPEC CACHE DIRECTORY: /Users/mirai/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/mirai/.rvm/rubies/ruby-2.5.3/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-18
- GEM PATHS:
- /Users/mirai/.rvm/gems/ruby-2.5.3#greentea-b2b
- /Users/mirai/.rvm/gems/ruby-2.5.3#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://gems.rubyforge.org/"]
- "update" => "--env-shebang"
- "benchmark" => false
- "install" => "--env-shebang"
- "gem" => "-n/usr/local/bin"
- REMOTE SOURCES:
- http://gems.rubyforge.org/
- SHELL PATH:
- /Users/mirai/.rvm/gems/ruby-2.5.3#greentea-b2b/bin
- /Users/mirai/.rvm/gems/ruby-2.5.3#global/bin
- /Users/mirai/.rvm/rubies/ruby-2.5.3/bin
- /Users/mirai/.rvm/bin
- /usr/local/opt/openssl/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /opt/local/bin
- /opt/local/sbin
- /usr/local/MacGPG2/bin
- /opt/X11/bin
I'm using AWS. bundle exec cap production deploy throws the same error.

Running a script from gem in GitHub in RVM

Can anyone help me walk through what I'm doing wrong here? This is my first go w/ Ruby so any help would be appreciated:
I've installed RVM and executing it through Terminal
I'm trying to run the script detailed in this post from GitHub:
https://github.com/michiels/helpscout-export
I was successfully able to install the gem 'HelpScout'
When I run ruby export.rb MY_api_key I get this error message:
ruby: No such file or directory -- export.rb (LoadError)
Anyone have any insight? Here's my current gem environment:
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.8
- RUBY VERSION: 2.0.0 (2013-11-22 patchlevel 353) [x86_64-darwin15.0.0]
- INSTALLATION DIRECTORY: /Users/stevekrause/.rvm/gems/ruby-2.0.0-p353
- RUBY EXECUTABLE: /Users/stevekrause/.rvm/rubies/ruby-2.0.0-p353/bin/ruby
- EXECUTABLE DIRECTORY: /Users/stevekrause/.rvm/gems/ruby-2.0.0-p353/bin
- SPEC CACHE DIRECTORY: /Users/stevekrause/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/stevekrause/.rvm/rubies/ruby-2.0.0-p353/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-15
- GEM PATHS:
- /Users/stevekrause/.rvm/gems/ruby-2.0.0-p353
- /Users/stevekrause/.rvm/gems/ruby-2.0.0-p353#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/stevekrause/.rvm/gems/ruby-2.0.0-p353/bin
- /Users/stevekrause/.rvm/gems/ruby-2.0.0-p353#global/bin
- /Users/stevekrause/.rvm/rubies/ruby-2.0.0-p353/bin
- /Users/stevekrause/.rvm/bin
- /Library/Frameworks/Python.framework/Versions/3.5/bin
- /Users/stevekrause/anaconda/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin

bundle install hangs inexplicably

I am on RHEL 6, and have built Ruby from source and installed into /usr/local.
The server I am on does not have outside internet access, EXCEPT to access Rubygems.org. That is the only outside connection it is permitted to make. This is a corporate security restriction and there is nothing I can do, so please don't say 'use rvm'. I would if I could...
I need to run bundle install as a certain user, ciwasadm. But when I do, the terminal just hangs. When I run bundle install or gem install whatever as my username, wannia1, I am able to connect to Rubygems.org and get wahtever I need.
For some reason, the hanging only occurs when I am sudo'ed into ciwasadm. The Ruby installation for both users is working and I can run ruby files in the command line. I just don't understand why bundler is any different.
Running gem env for ciwasadm returns:
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.8
- RUBY VERSION: 2.0.0 (2015-04-13 patchlevel 645) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.0.0
- RUBY EXECUTABLE: /usr/local/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /home/ciwasadm/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/local/lib/ruby/gems/2.0.0
- /home/ciwasadm/.gem/ruby/2.0.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/bin
- /sbin
- /bin
- /usr/sbin
- /usr/bin
- /opt/groovy-1.8.3/bin
Running gem env for wannia returns:
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.8
- RUBY VERSION: 2.0.0 (2015-04-13 patchlevel 645) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.0.0
- RUBY EXECUTABLE: /usr/local/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /home/wannia1/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/local/lib/ruby/gems/2.0.0
- /home/wannia1/.gem/ruby/2.0.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/bin
- /usr/lib64/qt-3.3/bin
- /usr/local/bin
- /bin
- /usr/bin
- /usr/local/sbin
- /usr/sbin
- /sbin
- /opt/groovy-1.8.3/bin
- /home/wannia1/bin
I'll post my solution here with the hopes that it helps someone else in the future.
Bundler was hanging because it could not reach the rubygems.org server. This is because a proxy was required, but had not been set.
I was able to run export http_proxy=<insert proxy info here> in my bash shell, and then was able to dial out.

Two ruby versions, need tidying up

I seem to have multiple ruby / rubygem installations on my server.
The gem environment for each is:
root#weepingangel:~# gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 2.2.0
- RUBY VERSION: 2.1.0 (2013-12-25 patchlevel 0) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/local/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0
- RUBY EXECUTABLE: /usr/local/rbenv/versions/2.1.0/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/rbenv/versions/2.1.0/bin
- SPEC CACHE DIRECTORY: /root/.gem/specs
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/local/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0
- /root/.gem/ruby/2.1.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://gems.rubyforge.org", "http://gems.github.com"]
- "gem" => "--no-ri --no-rdoc"
- REMOTE SOURCES:
- http://gems.rubyforge.org
- http://gems.github.com
- SHELL PATH:
- /usr/local/rbenv/versions/2.1.0/bin
- /usr/local/rbenv/libexec
- /usr/local/rbenv/shims
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
root#weepingangel:~# sudo gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.11
- RUBY VERSION: 1.9.3 (2011-10-30 patchlevel 0) [x86_64-linux]
- INSTALLATION DIRECTORY: /var/lib/gems/1.9.1
- RUBY EXECUTABLE: /usr/bin/ruby1.9.1
- EXECUTABLE DIRECTORY: /usr/local/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /var/lib/gems/1.9.1
- /root/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://gems.rubyforge.org", "http://gems.github.com"]
- "gem" => "--no-ri --no-rdoc"
- REMOTE SOURCES:
- http://gems.rubyforge.org
- http://gems.github.com
Does anyone know how I can clear these up as I only need one and I think I have things looking at my $PATH but it's pointing to the wrong one.
If you use rbenv you can run this in your profile to set the default ruby environment.
$rbenv global 2.2.0
Hope this helps.

Resources