Jekyll not serving locally - 'could not find jekyll' - ruby

I have little-to-no experience with ruby, but have been managing to successfully maintain a Jekyll site with github. However, for some unknown reason, when I cd into my website's directory and run jekyll serve I get the following error:
Could not find 'jekyll' (>= 0) among 7 total gem(s) (Gem::MissingSpecError)
Here is the full error message:
/usr/local/Cellar/ruby/2.4.1_1/lib/ruby/2.4.0/rubygems/dependency.rb:308:in `to_specs': Could not find 'jekyll' (>= 0) among 7 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/Users/amin/.gem/ruby/2.4.0:/usr/local/lib/ruby/gems/2.4.0:/usr/local/Cellar/ruby/2.4.1_1/lib/ruby/gems/2.4.0', execute `gem env` for more information
from /usr/local/Cellar/ruby/2.4.1_1/lib/ruby/2.4.0/rubygems/dependency.rb:320:in `to_spec'
from /usr/local/Cellar/ruby/2.4.1_1/lib/ruby/2.4.0/rubygems/core_ext/kernel_gem.rb:65:in `gem'
from /usr/local/bin/jekyll:22:in `<main>'
Trying gem env gives this, which looks a little messy:
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.5
- RUBY VERSION: 2.2.2 (2015-04-13 patchlevel 95) [x86_64-darwin15]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.2.0
- RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /Users/amin/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/2.2.2/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-15
- GEM PATHS:
- /usr/local/lib/ruby/gems/2.2.0
- /Users/amin/.gem/ruby/2.2.0
- /usr/local/Cellar/ruby/2.2.2/lib/ruby/gems/2.2.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/amin/Dropbox/code/google-cloud-platform/google-cloud-sdk/bin
- //anaconda/bin
- /opt/local/bin
- /opt/local/sbin
- /opt/local/bin
- /opt/local/sbin
- /Library/Frameworks/Python.framework/Versions/3.4/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /opt/X11/bin
- /Library/TeX/texbin
My best guess is that Jekyll should be looking in usr/local/bin, and not usr/local/Cellar, but as I say, that's just a guess.
Any advice on how to get this working again would be greatly appreciated!

Related

Cannot load such file --mechanize

There is a class called ParseSearch.rb, which uses mechanize gem.
I made a new file that is used for Ruby Shoes(GUI) and I required all gems that are needed
require "mechanize"
require "rubygems"
require_relative "ParseSearch.rb"
In the terminal I installed the gem
$ gem install mechanize
Successfully installed mechanize-2.7.6
Parsing documentation for mechanize-2.7.6
Done installing documentation for mechanize after 0 seconds
1 gem installed
However, when I run the shoes.rb I get a error
Error in <unknown> line 0 | 2020-02-16 15:40:27 -0500
cannot load such file -- mechanize
.shoes/walkabout/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:59:in `require'
.shoes/walkabout/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:59:in `require'
search_shoes.rb:1:in `<main>'
.shoes/walkabout/lib/shoes.rb:353:in `eval'
.shoes/walkabout/lib/shoes.rb:353:in `visit'
.shoes/walkabout/lib/shoes.rb:139:in `show_selector'
.shoes/walkabout/lib/shoes.rb:169:in `block (4 levels) in splash'
The gem env are shown below.
RubyGems Environment:
- RUBYGEMS VERSION: 3.0.3
- RUBY VERSION: 2.6.3 (2019-04-16 patchlevel 62) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/daniel/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0
- USER INSTALLATION DIRECTORY: /.gem/ruby/2.6.0
- RUBY EXECUTABLE: /.rbenv/versions/2.6.3/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /.rbenv/versions/2.6.3/bin
- SPEC CACHE DIRECTORY: /.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /.rbenv/versions/2.6.3/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0
- /.gem/ruby/2.6.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /.rbenv/versions/2.6.3/bin
- /.rbenv/libexec
- /.rbenv/plugins/ruby-build/bin
- /.rbenv/shims
- /.rbenv/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games
- /snap/bin

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

Adding gems on Sierra OS

I've tried to update, as well as run existing Ruby gems after upgrading to OS X Sierra.
> sudo gem update --system
> Password: *enters password*
> Updating rubygems-update...
> ERROR: While executing gem ... (Errno::EPERM)
> Operation not permitted - /usr/bin/update_rubygems
This happens whether I execute directly from RubyGems or clone and pull down from Github. Running the command with sudo also returns an error saying I lack permissions.
I tried sudo rubygems_update :
/usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/rubygems/dependency.rb:308:in `to_specs': Could not find 'rubygems-update' (>= 0.a) among 7 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/Users/Angelfirenze/.gem/ruby/2.4.0:/usr/local/lib/ruby/gems/2.4.0:/usr/local/Cellar/ruby/2.4.0/lib/ruby/gems/2.4.0', execute `gem env` for more information
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/rubygems/dependency.rb:320:in `to_spec'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_gem.rb:65:in `gem'
from /usr/local/bin/update_rubygems:22:in `<main>'
I have just executed gem env and my terminal returned the following:
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.8
- RUBY VERSION: 2.0.0 (2015-12-16 patchlevel 648) [universal.x86_64-darwin16]
- 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
- SPEC CACHE DIRECTORY: /Users/Angelfirenze/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-16
- GEM PATHS:
- /Library/Ruby/Gems/2.0.0
- /Users/Angelfirenze/.gem/ruby/2.0.0
- /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/Angelfirenze/.rbenv/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /usr/local/git/bin
- /usr/local/MacGPG2/bin
- /Users/Angelfirenze/.rvm/bin
- /Users/Angelfirenze/bin
- /Users/Angelfirenze/bin
Maybe installing rvm would be the best option. I usually avoid the default ruby that comes shipped with OS X.
With that said I think Sierra ships with new security that needs to be disabled you can read about it here: Disable Mac OS SIP

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

Rails 4.2 and gem config broken

My OS X ruby dev environment is broken, I don't know why.
I undesrtood that the gem path is wrong, but I don't know how to fix it.
/Users/muqaddar/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'rails' (>= 0) among 14 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/muqaddar/.rvm/gems/ruby-2.0.0-p598:/Users/muqaddar/.rvm/gems/ruby-2.0.0-p598#global', execute `gem env` for more information
from /Users/muqaddar/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:324:in `to_spec'
from /Users/muqaddar/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
from /usr/bin/rails:22:in `<main>'
Here is my config with gem env:
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.6
- RUBY VERSION: 2.0.0 (2014-11-13 patchlevel 598) [x86_64-darwin14.1.0]
- INSTALLATION DIRECTORY: /Users/muqaddar/.rvm/gems/ruby-2.0.0-p598
- RUBY EXECUTABLE: /Users/muqaddar/.rvm/rubies/ruby-2.0.0-p598/bin/ruby
- EXECUTABLE DIRECTORY: /Users/muqaddar/.rvm/gems/ruby-2.0.0-p598/bin
- SPEC CACHE DIRECTORY: /Users/muqaddar/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/muqaddar/.rvm/rubies/ruby-2.0.0-p598/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-14
- GEM PATHS:
- /Users/muqaddar/.rvm/gems/ruby-2.0.0-p598
- /Users/muqaddar/.rvm/gems/ruby-2.0.0-p598#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/muqaddar/.rvm/gems/ruby-2.0.0-p598/bin
- /Users/muqaddar/.rvm/gems/ruby-2.0.0-p598#global/bin
- /Users/muqaddar/.rvm/rubies/ruby-2.0.0-p598/bin
- /usr/local/mysql/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /opt/X11/bin
- /Users/muqaddar/.rvm/bin
I tried many things, reading lots of threads.
- reinstall rvm
- remove .vendor/bundle
- bundle install
...etc
I think the gems are not installed in the right directory. How to change that depending my rvm config ?
You should try and follow these steps if you are using a mac: http://www.installrails.com/
Note that when installing a new gem, you first have to add it to the Gemfile inside your editor. For example: gem 'bootstrap-sass', '~> 3.3.3'
After doing this navigate to your folder using terminal and type: "bundle install". This will install your added gems.

Resources