Absolute beginner

Ok, I think I am done now. Everything seems to be installed. I do not know exactly what I did, but this time I did not receive any error messages. Later on, I will learn all that stuff, no doubt. but the very first goal is to have a very simple site (maybe just an index.html and some kind of basic CSS) visible in the browser.

It would be great, if you continue guiding me threw the process. Even if I feel a little bit simple minded. :wink:

What I know (or believe to know) is:

  1. I have a place somewhere on my machine (Mac) where I can create files.
  2. I need some webspace on GitHub where I can export the stuff I am doing on my local machine.
  3. I need some programme that connects to the GH space and pushed my creation there.
  4. I need to connect the GH-space with any URL (for the moment, I do not care, where it is visible. The first goal says: "any URL will be fine.)

So the basic questions:

  • How do I define that place where I work on my machine in the command line?
  • Can I fetch a readymade template or some kind of basic structure from somewhere and place it in my working folder?
  • How can I move it to github?
  • how do I connect it to a URL to make it visible?

Is there a basic tutorial available?
thanks
Raphael

OK, I think i found one: https://jekyllrb.com/docs/step-by-step/01-setup/a
and I already created a Gemfile (whatecer that might be. :wink: But I located it on my machine. Feels great!

Ok, the first showstopper appears. :frowning:
Raphaels-MacBook-Pro:~ raphaelbolius$ gem “jekyll”
ERROR: While executing gem … (Gem::CommandLineError)
Unknown command jekyll
Raphaels-MacBook-Pro:~ raphaelbolius$

What is my mistake exactly?
Any ideas? :wink: I just did, what the tut said. :wink:

Thanks
Raphael

When you run

gem install 'jekyll'

That is in the shell.

When something says

gem 'jekyll'

That means it is Ruby code which goes in a Gemfile (which contains ruby code). It must not be run in the shell.

git is the command line tool you need to fetch files on github and push local changes to github.

The repo on github corresponds to a folder your machine, usually with the same name.

Keep going with the 10 step tutorial.

Once you can setup a site on github, you can add a custom URL on top.

I’m reading this thread and feeling for you! I went through a lot of this initially and here is what I can tell you at a high level. You need to install Ruby. Once you accomplish that step, you really won’t have to think about it any more. You will code your project with CSS (or SASS/SCSS), and HTML. You might use a few plugins and you will need to familiarize yourself with the super simple Liquid language (Shopify uses it for people designing stores).

After you follow the setup instructions you can create your site locally and then publish to a hosting provider. I actually use GitHub Pages, which is free so you and your customer can immediately start reviewing the site.

I left Wordpress and moved to Jekyll and it was hard. You install Wordpress as an app. Jekyll is more of a framework. You have to build the site from scratch (or find themes) and add program what you want. You can always start with the default Minima theme that Jekyll ships with and modify it.

After your dev machine is set up locally, you can check out my videos here and they will get you up and running:

From there, if you want to keep learning you can link to my YouTube channel and find tons of content I created during my journey setting up Jekyll for my site. Of course this Jekyll Talk forum and super helpful.

Hope this helps as a more generic overview and did not interrupt the discussion too much.

Hi BillRaymond,
thanks a lot for your helpfull words. Nevertheless I an stuck in the very beginning. Please look at this messages from the commandline. That does not make any sense. :wink: I installed ruby, ruby gem, jekyy and bundler and I have error messages.

Look here:
Raphaels-MacBook-Pro:~ raphaelbolius$ ruby -v
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin17]
Raphaels-MacBook-Pro:~ raphaelbolius$ gem -v
3.1.4
Raphaels-MacBook-Pro:~ raphaelbolius$ gem install jekyll bundler
Successfully installed jekyll-4.1.1
Parsing documentation for jekyll-4.1.1
Done installing documentation for jekyll after 2 seconds
Successfully installed bundler-2.1.4
Parsing documentation for bundler-2.1.4
Done installing documentation for bundler after 4 seconds
2 gems installed
Raphaels-MacBook-Pro:~ raphaelbolius$ jekyll -v
-bash: jekyll: command not found
Raphaels-MacBook-Pro:~ raphaelbolius$

Where is the mistake??? everything is here.

Thanks
Raphael

Run this and you should see Jekyll.

ls ~/.gem/ruby/2.7.0/bin

Try add that directory again to PATH. I covered ZSH as well - if you use Catalina you might have switched to ZSH.

echo 'export PATH="$HOME/.gem/ruby/2.7.0/bin:$PATH"' >> ~/.bashrc
echo 'export PATH="$HOME/.gem/ruby/2.7.0/bin:$PATH"' >> ~/.zshrc

Note also that your output tells me to have ruby 2.7 installed. So if you had that line with 2.6 before as per earlier comments, you need 2.7 rather.

Then start a new terminal and run

echo $PATH

And you should expect ruby bin there.

Then run

jekyll

In the first place: thanks.
But: Sorry, it is like if you told me things in Chinese. :wink: I never used the terminal before. I feel like an idiot. :frowning:

Now I got this:
echo PATH Last login: Fri Nov 20 19:54:08 on ttys000 Raphaels-MacBook-Pro:~ raphaelbolius echo PATH /usr/local/opt/ruby/bin:/usr/local/opt/ruby/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/MacGPG2/bin:/Applications/Wireshark.app/Contents/MacOS Raphaels-MacBook-Pro:~ raphaelbolius jekyll
-bash: jekyll: command not found
Raphaels-MacBook-Pro:~ raphaelbolius$
Raphaels-MacBook-Pro:~ raphaelbolius$ jekyll -v
-bash: jekyll: command not found
Raphaels-MacBook-Pro:~ raphaelbolius$ ls ~/.gem/ruby/2.7.0/bin
bundle bundler jekyll kramdown listen rougify safe_yaml
Raphaels-MacBook-Pro:~ raphaelbolius$ echo 'export PATH="$HOME/.gem/ruby/2.7.0/bin:PATH"' >> ~/.bashrc Raphaels-MacBook-Pro:~ raphaelbolius echo PATH /usr/local/opt/ruby/bin:/usr/local/opt/ruby/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/MacGPG2/bin:/Applications/Wireshark.app/Contents/MacOS Raphaels-MacBook-Pro:~ raphaelbolius jekyll
-bash: jekyll: command not found
Raphaels-MacBook-Pro:~ raphaelbolius$

That shows me Jekyll is there but your path is still incomplete.

Try this ZSH line. The end part is different to what you did above.

echo 'export PATH="$HOME/.gem/ruby/2.7.0/bin:$PATH"' >> ~/.zshrc

Then open a new terminal and

echo $PATH
jekyll -v

Hi @rabo. I’m sorry you had to go through this. If you’re still stuck, I’m pretty sure I know exactly what the problem is as I have seen people get confused when trying to install Ruby gems over and over again. From your latest terminal output, I see that you are using the bash shell, and so any export PATH commands need to be added to your ~/.bash_profile, not ~/.zshrc, and definitely not ~/.bashrc because it doesn’t get read on a Mac.

I’m also guessing that you installed Ruby via Homebrew, and unfortunately, the Jekyll installation instructions are missing a very important step, which is to update the PATH with the Homebrew gems location. All the other gem paths mentioned in the other replies are not going to have any effect if you installed Ruby with Homebrew.

Here are 2 options to get everything working:

  1. Use my script, which will automatically set everything up for you: https://github.com/monfresh/laptop
    Make sure to quit and restart Terminal after you see “All done!” when the script is finished running.

  2. Attempt to fix things manually:
    First, run open ~/.bash_profile
    This will open the file in TextEdit
    Look for any lines that look like export PATH="/usr/local/opt/ruby/bin:$PATH. It looks like you might have 2 of those.
    Remove them and replace them with this:

export PATH="/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/2.7.0/bin:/usr/local/bin:$PATH"

Save the file
Quit and restart your Terminal
You should now be able to run jekyll -v and get an answer.

To learn more about how Ruby, gems, and PATH work, read these guides that I wrote:



Following on from the above answer.

I can’t actually see what the default shell is. Raphael can you run this?

echo $SHELL

If you give you bash or ZSH and then you know whether to change a bash or ZSH file.

Yes I think there is a step missing to add custom Homebrew Ruby before system ruby.

Here is my solution:

export RUBY_HOME=/usr/local/opt/ruby/bin
export PATH="$RUBY_HOME:$PATH"

In addition to above, you can also add this as discussed in my previous messages.

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

That supports installs to your users ~/.gem/ dir such as:

gem install bundler --user-install

And that works well with the Homebrew setup.


I’d be cautious about running the suggested script that sets things up for you as you won’t know what steps were actually done and how to change or debug things.

This gist I have covers setting up Ruby, Bundler and Jekyll on mac starting with no paths or Ruby installed and contains the essential steps needed to get running. I hope it serves you well.


You can also add this part as suggested by @monfresh

export PATH="/usr/local/lib/ruby/gems/2.7.0/bin:$PATH"

But that is for if you do an install to gems shared by all users which requires sudo access, which I’d advise against for security reasons.

sudo gem install bundler

Or you have to change permissions of /usr/local so any user has write access without sudo.

I can tell he is using bash from this line in the output he pasted:

-bash: jekyll: command not found

I can also see that he already has /usr/local/opt/ruby/bin in his PATH, twice even.

@MichaelCurrin Your last statement about sudo being required to install gems is not correct in this scenario. When you install Homebrew, it prompts you for your macOS password, which allows it to automatically change the permissions of /usr/local so that you can install tools with Homebrew.

Once Ruby is installed with Homebrew, in order to install gems (without any flags) and be able to use them, you need both the location of the Homebrew Ruby and the location of the directory where Homebrew installs gems. So, you need both of these in the PATH:

/usr/local/opt/ruby/bin
/usr/local/lib/ruby/gems/2.7.0/bin

I have tested Ruby installation on Mac extensively over the past 8 years. I keep a spare laptop to test things every time a new macOS is released.

I don’t think we should be confusing beginners with the --user-install option. Most Ruby gems don’t mention that flag in their installation instructions, and so when people type gem install jekyll, or gem install rails, they expect to be able to use the jekyll and rails commands, which requires that their PATH is configured with the gems location that corresponds with their Ruby installation.

I believe in making things as simple as possible for people, which is why I wrote my script, to make it as painless as possible. Discourse, the Ruby app that powers this Jekyll Forum, also provides a script for easy installation: https://meta.discourse.org/t/beginners-guide-to-install-discourse-on-macos-for-development/15772. I wish more Ruby projects would make things easier for beginners.

Also, echo $SHELL is not always reliable. echo $0 is better. I wrote about this as well. See the bottom of this article (in the “Alternative” section) for a scenario where echo $SHELL could return the wrong answer: https://www.moncefbelyamani.com/which-shell-am-i-using-how-can-i-switch/

Thanks for sharing. From my research, $SHELL is the default shell while $0 is current shell and $0 is probably more usable in general

1 Like

That’s nice to know about Homebrew changing permissions for you.

For Linux though, one has to still change the permissions of the dir with sudo