can't find gem jekyll (>= 0.a) with executable jekyll (Gem::GemNotFoundException)
Asked Answered
A

3

6

I am trying to make my personal website using github and jekyll following the instructions on the official website

When I reach the part:

jekyll new --skip-bundle

I received:

can't find gem jekyll (>= 0.a) with executable jekyll (Gem::GemNotFoundException)

I tried several approaches, such as the one mentioned here and I ran the command with sudo. Again after running jekyll new --skip-bundle .

Here is the terminal response after installing with instructions here

Fetching bundler-2.4.5.gem
Successfully installed bundler-2.4.5
Parsing documentation for bundler-2.4.5
Installing ri documentation for bundler-2.4.5
Done installing documentation for bundler after 0 seconds
1 gem installed

And here is the terminal response when I run jekyll new --skip-bundle again:

Traceback (most recent call last):
    2: from /usr/local/bin/jekyll:22:in `<main>'
    1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:262:in `bin_path'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': can't find gem jekyll (>= 0.a) with executable jekyll (Gem::GemNotFoundException)

I appreciate if you can help me how to solve it. I use macOs.

Update:

I run bundle add jekyll and I received:

Your RubyGems version (3.0.3) has a bug that prevents `required_ruby_version` from working for Bundler. Any scripts that use `gem install bundler` will break as soon as Bundler drops support for your Ruby version. Please upgrade RubyGems to avoid future breakage and silence this warning by running `gem update --system 3.2.3

Could not locate Gemfile`

Then I run gem update --system 3.2.3

Updating rubygems-update
Fetching rubygems-update-3.2.3.gem
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.
    

Next step I run sudo gem update --system 3.2.3 and I received:

Updating rubygems-update
Fetching rubygems-update-3.2.3.gem
Successfully installed rubygems-update-3.2.3
Parsing documentation for rubygems-update-3.2.3
Installing ri documentation for rubygems-update-3.2.3
Installing darkfish documentation for rubygems-update-3.2.3
Done installing documentation for rubygems-update after 78 seconds
Parsing documentation for rubygems-update-3.2.3
Done installing documentation for rubygems-update after 0 seconds
Installing RubyGems 3.2.3
ERROR:  While executing gem ... (Errno::EROFS)
    Read-only file system @ rb_sysopen - /usr/share/man/man1/bundle-platform.1

So still I failed to add jekyll....

System information:

Ruby: ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19] Gem: 3.2.3 Bundler: version 2.4.6 Homebrew: Homebrew 3.6.20

Homebrew/homebrew-core (git revision fc36a19edf4; last commit 2023-02-04)
Homebrew/homebrew-cask (git revision 4c5d3e2391; last commit 2023-02-04)

CPU: Darwin Kernel Version 19.6.0: Mon Aug 31 22:12:52 PDT 2020; root:xnu-6153.141.2~1/RELEASE_X86_64

Update 2: Should I run these commands where my gem files are located?

I run gem environment and here is what I received. In which directory should I run these commands?

RubyGems Environment:
  - RUBYGEMS VERSION: 3.2.3
  - RUBY VERSION: 2.6.3 (2019-04-16 patchlevel 62) [universal.x86_64-darwin19]
  - INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.6.0
  - USER INSTALLATION DIRECTORY: /Users/shirinvafaei/.gem/ruby/2.6.0
  - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
  - GIT EXECUTABLE: /usr/local/bin/git
  - EXECUTABLE DIRECTORY: /usr/bin
  - SPEC CACHE DIRECTORY: /Users/shirinvafaei/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
  - RUBYGEMS PLATFORMS:
     - ruby
     - universal-darwin-19
  - GEM PATHS:
     - /Library/Ruby/Gems/2.6.0
     - /Users/shirinvafaei/.gem/ruby/2.6.0
     - /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/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:
     - /Users/shirinvafaei/.rbenv/shims
     - /Users/shirinvafaei/.rbenv/bin
     - /usr/local/Cellar/ruby/2.4.1_1/bin
     - /usr/local/bin
     - /Users/shirinvafaei/opt/anaconda3/bin
     - /Users/shirinvafaei/opt/anaconda3/condabin
     - /Library/Frameworks/Python.framework/Versions/2.7/bin
     - /Library/Frameworks/Python.framework/Versions/3.8/bin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /opt/X11/bin

Another update: I tried

rben install 3.0.5

and I received this error message:

eb322180c6f18a6f74e4b6aa
Installing openssl-1.1.1s...

BUILD FAILED (Mac OS X 10.15.7 using ruby-build 20230202)

Inspect or clean up the working tree at /var/folders/yk/clm8vmf15r9cv4hghy2wm6380000gn/T/ruby-build.20230215141911.2345.jn3ObC
Results logged to /var/folders/yk/clm8vmf15r9cv4hghy2wm6380000gn/T/ruby-build.20230215141911.2345.log

Last 10 log lines:
      _dgram_write in bss_dgram.o
      _fd_write in bss_fd.o
      _fd_puts in bss_fd.o
      _sock_write in bss_sock.o
      _sock_puts in bss_sock.o
     (maybe you meant: _UI_method_get_writer, _RAND_write_file , _PEM_write_bio_PKCS7_stream , _PEM_write_X509_AUX , _PEM_write_PrivateKey , _PEM_write_bio_PrivateKey_traditional , _PEM_write_bio_PrivateKey , _PEM_write_PKCS8_PRIV_KEY_INFO , _PEM_write_bio_PKCS8_PRIV_KEY_INFO , _PEM_write_PKCS8PrivateKey , _PEM_write_bio_PKCS8PrivateKey , _PEM_write_bio , _PEM_X509_INFO_write_bio , _PEM_write_bio_PUBKEY , _PEM_write_DHparams , _PEM_write_EC_PUBKEY , _PEM_write_bio_EC_PUBKEY , _PEM_write_bio_ECPKParameters , _PEM_write_DSA_PUBKEY , _PEM_write_bio_RSA_PUBKEY , _PEM_write_RSAPublicKey , _PEM_write_PKCS7 , _PEM_write_bio_PKCS7 , _PEM_write_X509_CRL , _PEM_write_bio_X509_REQ_NEW , _PEM_write_X509_REQ , _PEM_write_bio_X509 , _PEM_write_PKCS8 , _PEM_write_DHxparams , _PEM_write_DSAparams , _PEM_write_ECPKParameters , _PEM_write_bio_RSAPrivateKey , _UI_method_set_writer , _PEM_write_bio_X509_AUX , _PEM_write_ECPrivateKey , _SMIME_write_CMS , _PEM_write_DSAPrivateKey , _PEM_write_X509 , _PEM_write , _PEM_write_bio_DSAPrivateKey , _PEM_write_bio_X509_CRL , _PEM_write_bio_NETSCAPE_CERT_SEQUENCE , _SMIME_write_PKCS7 , _PEM_ASN1_write , _PEM_ASN1_write_bio , _PEM_write_bio_CMS , _CRYPTO_THREAD_write_lock , _PEM_write_bio_DHxparams , _PEM_write_bio_DSAparams , _PEM_write_RSA_PUBKEY , _TXT_DB_write , _PEM_write_PUBKEY , _BIO_meth_set_write_ex , _BIO_meth_set_write , _BIO_meth_get_write , _PEM_write_bio_DSA_PUBKEY , _BIO_write_ex , _PEM_write_bio_X509_REQ , _PEM_write_bio_Parameters , _PEM_write_bio_ECPrivateKey , _PEM_write_bio_PKCS8 , _PEM_write_X509_REQ_NEW , _PEM_write_bio_DHparams , _BIO_ctrl_get_write_guarantee , _BIO_meth_get_write_ex , _PEM_write_bio_PKCS8PrivateKey_nid , _PEM_write_bio_ASN1_stream , _PEM_write_bio_CMS_stream , _BIO_write , _PEM_write_CMS , _PEM_write_RSAPrivateKey , _PEM_write_NETSCAPE_CERT_SEQUENCE , _PEM_write_PKCS8PrivateKey_nid , _SMIME_write_ASN1 , _PEM_write_bio_RSAPublicKey )
ld: symbol(s) not found for architecture x86_64
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [libcrypto.dylib] Error 1
make: *** [all] Error 2

Do you know how can I fix this one?

Authority answered 31/1, 2023 at 13:1 Comment(1)
maybe stop using system ruby 2.6Haemal
A
2

Here is the terminal response after installing with instructions here

You are running this to install Bundler (You can think about it as the gem storage). And here you know that for the jekyll error code, it has the same issue (it is not finding the source to run jekyll). To fix this, install jekyll

If you want to run the jekyll from bundler, try this (recommended) Reference

bundle add jekyll #This will add jekyll to Gemfile (gem dependencies manager)
bundle install #This will check/install the gem from Gemfile
bundle exec jekyll #This will run jekyll from the bundle

If you don't want to use bundle, you can install the gem directly

gem install jekyll
jekyll #this should work and have message related to jekyll

Edit after update 1: (and posted reply to further debug things)

Basically, if you can do these (manual thing of the commands above)

  1. Have Gemfile with gem "jekyll" line inside
  2. can run bundle install and success, then you can proceed with the other jekyll related things.
Avery answered 3/2, 2023 at 4:54 Comment(5)
Thank you very much for your message. I tried your instructions, however I failed. I updated my question with my second attemptAuthority
@Authority can you clarify some version that you have in your system. 1. ruby: ruby -v, 2. gem: gem -v, 3. bundle: bundle -v, (next is less related but might be good to know) 4. homebrew: brew -v 5. mac CPU type: uname -mAvery
Thank you very much. I added the info to my question. Would you please check?Authority
Do you mean I should run the commands above in the directory where there are gem files. I run "gem environment", and I updated my question with the terminal reply of this command.Authority
Gemfile not gem file, are you aware of this file?Avery
L
0

Ruby 2.6 is the 2018 version and has reached end of life

I'd start by upgrading ruby to 3.0 or 3.1 (a lot of gems may not be compatible with 3.2 yet)

Read-only file system @ rb_sysopen Permission issue perhaps? Check if the directory is read only or root access only.

rbenv is a tool for managing ruby versions. You could consider installing ruby through rbenv instead of a plain system install. Would probably solve the permission problem as well.

Lovins answered 8/2, 2023 at 9:27 Comment(0)
B
0

I see several problems with your setup.

  1. You are using an EOL version of Ruby that is no longer supported.
  2. You are using a system installed ruby which requires root permissions to manage. Apart from security considerations, this creates further issues in gem maintenance.
  3. Because you are forced to run gem install as superuser I don't think that the jekyll binary is set up correctly in the correct path. I think what may have happened is that paths or binaries were setup for the root user instead of your user, as a side effect of running with sudo.

What I recommend is installing a userspace Ruby version manager. My preferred is rbenv because if it's simplicity of operation, but there are others like RVM.

What this entails is:

  1. Installing rbenv (it's quite simple - just follow their README).
  2. Install a recent Ruby version that jekyll supports, like 3.0.5 via:
    rbenv install 3.0.5
    
  3. Run bundle install or gem install jekyll.

rbenv will setup your Ruby environment in userspace where sudo will not be required. All binaries should be correctly accessible in your path and your setup should now be working correctly.

P.S. You may have to restart your terminal session after installing rbenv and after installing the required Ruby version.

Backwater answered 8/2, 2023 at 10:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.