Jekyll not running - "bad interpreter: No such file or directory"

Hi everyone,
I’m currently working on a Github Pages project. I’m using a template called Tale (dowloaded and pushed on my repo).

When trying to preview my website locally, I used jekyll serve -w as I usually do and have pretty much entered a world of pain.

I realized Jekyll wasn’t up to date, and I had authorization issues to proceed with the updates.
I followed several tutorial recomending to update Xcode, which I could not do without updating my mac to Catalina, so I switched to Catalina.
After this update, I opened the terminal to read that The default interactive shell is now zsh.

I then tried multiple things :

  • updating jekyll, but it was denied because /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory
  • I tried reinstalling Jekyll using Brew; Brew was malfunctioning so I tried to update it, failed, and reinstalled it instead;
  • I tried gem install Jekyll, was denied with the same no such file message
  • I tried reinstalling Ruby (brew install ruby), which seemed to have worked;
  • I ran a script called Laptop using [this thread](bash <(curl -s https://raw.githubusercontent.com/monfresh/laptop/master/laptop)) (did both methods: with the automated script and manually)
  • I ran gem install jekyll which worked; jekyll seemed uptodate
  • However, jekyll serve -v still doesn’t work and returns /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory

I have resisted using sudo because of the multiple forum threads stating it was to be avoided as much as possible (I have used in the past, though).

If anyone has any ideas on this… I’d love to hear their thoughts.
(disclaimer: I’m a web designer, using github for several projects, but obviously no expert in ruby etc.)
thanks / stay safe home if you can :slight_smile:

Hi. I had the same troubles with Catalina some months ago.

I documented my solution here. In particular see the Ruby link that has a Catalina guide. And then follow the Jekyll “user” guide (this avoids sudo)

1 Like

Hi Michael,
And thank you so much for taking the time to answer & help.

I have followed your suggestions several times, with slightly different effects, but no success.
In a nutshell:
I successfully reinstalled Ruby using brew reinstall ruby;
Then updated the Paths in the zshrc file;
which ruby and which bundler return similar paths as those indicated in your tutorial; which gem however returns:

gem () {
	\typeset result
	(
		\typeset rvmrc
		rvm_rvmrc_files=("/etc/rvmrc" "$HOME/.rvmrc") 
		if [[ -n "${rvm_prefix:-}" ]] && ! [[ "$HOME/.rvmrc" -ef "${rvm_prefix}/.rvmrc" ]]
		then
			rvm_rvmrc_files+=("${rvm_prefix}/.rvmrc") 
		fi
		for rvmrc in "${rvm_rvmrc_files[@]}"
		do
			[[ -s "${rvmrc}" ]] && source "${rvmrc}" || true
		done
		unset rvm_rvmrc_files
		command gem "$@"
	) || result=$? 
	hash -r
	return ${result:-0}
}

gem install --user-install bundler ran smoothly.

I’ve tried the last part, using sh-3.2$ as a the new shell. I tried to run jekyll serve -w but still get /usr/local/bin/jekyll: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory

The .zshrc file now looks like this :

    export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
    export RUBY_HOME=/usr/local/opt/ruby/bin
    export PATH="$RUBY_HOME:$PATH"

sh
export GEM_PATH="$HOME/.gem/ruby/2.7.0/bin"
export PATH="$GEM_PATH:$PATH"

Thank you in advance for any help you might provide / :pray:

I am not familiar with rvm. Can you get it to work without rvm and use standard gem command? As I know my instructions work for that. Then add rvm later.

It makes it confusing as you have two custom Ruby’s and their gem commands.

It might be possible to use rvm install a new ruby without using brew. Maybe the brew ruby and rvm are conflicting.

1 Like

Hi Michael,
Thank you for your time.

I found the solution to my problem, posting it here for the people who might run into the same difficulties.

This tutorial by Muffin Man gave me the solution (close to yours actually). I added a gems/bin path to my zsrhc file :
export PATH="/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/2.6.0/bin/:$PATH

I then had multiple problems of out-of-date gems - bundle update took care of them.

thanx again Michael :slight_smile:

1 Like