Getting Jekyll to run without sudo in fish shell


tl;dr - if you use fish shell you also need to set GEM_HOME in .bashrc for the bundle command to work properly

When I set up Jekyll on macOS using fish shell I ran into an issue that was a bit tricky to solve.

I followed the Jekyll quickstart guide, the requirements for macOS, and the instructions for --user-install. jekyll and bundle were available on $PATH, and which jekyll and which bundle showed that both executables were stored where I expected in my user directory.

Still, I got the error below:

Your user account is not allowed to install to the
system RubyGems. You can cancel this installation
and run:

    bundle install --path vendor/bundle

to install the gems into ./vendor/bundle/, or you
can enter your password and install the bundled gems
to RubyGems using sudo.

After double checking the environment variables in fish I figured I should follow the instructions to the letter and also add the variables to .bashrc.

And it worked!

So, when using fish you also need to set GEM_HOME in a .bashrc for bundle to work properly as it seemingly uses bash or the bash config internally.

I’m guessing we might see more issues like this pop up when macOS changes its default shell to zsh in Catalina.

Kategorisert under: jekyll, macOS, fishshell, bash

William Killerud er en utvikler som bor og jobber i Oslo. Du kan få nye poster i RSS-leseren din herfra.