Setting up your environment for Jekyll

8 minutes read

In this post, I’m going to show you how to configure your Windows, Linux and Mac OS X environment for Jekyll.

Getting to the point, I’ll start with Windows environment but if you want to go directly to your O.S.

Installing Jekyll on Linux
Installing Jekyll on Mac OS X

Jekyll on Windows

It’s not common to see the tutorial explaining how to set up Ruby on Windows because it’s not a “first-choice” environment to install Ruby and Rails.

First of all, I created this tutorial using Windows 10. Now you’re asking yourself.

Can I try to install it on Windows 7 or Windows 8 or Windows 8.1?

Well, you can try it, there aren’t vast differences between these OS, but you’re aware that I’ve installed on Windows 10, right!?

Installing Chocolatey

Chocolatey is a package manager for Windows (like apt-get or yum or dnf for Windows), we’re going to use it to install Ruby and Jekyll on Windows.

Open your command prompt as administrator mode.

# Copy the command line below
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

And paste the copied text into your command prompt. Press Enter and wait a few second for the command complete.

CMD chocolatey

CMD chocolatey2

If you don’t see any errors, we are ready to use Chocolatey.

# For sure that everything is ok, type: "choco" on the command prompt.
C:\>choco

CMD choco

Installing Ruby on Windows

Now we need to install Ruby, and it’s pretty simple. In command line.

# Copy and paste or type the code below on your terminal
# The "-y" is to confirm all answer instead prompting it. Press Enter
choco install ruby -y

CMD choco install ruby -y

If you don’t see any errors, all we need to do is refresh the console.

Refreshing the console

There are two ways to refresh the console, the usual and the lazy (or smart) way.

The usual way all you need to do is just simply close and re-open you command prompt.

Now for the lazy “smart” way you can just simply.

# Copy and paste or type the code below on your terminal
refreshenv

CMD refreshenv

Without close your command prompt.

Installing Jekyll and Bundler on Windows

To install Jekyll, it’s simple.

# Copy and paste or type the code below on your terminal
gem install jekyll

CMD gem install jekyll

CMD gem install jekyll2

Wait for a few second for complete it. Now we’re going to install Bundler.

Bundler is essential to ensure that the gems you need are present in development, staging, and production.

To install Bundler, it seems the same as Jekyll gem installation.

# Copy and paste or type the code below on your terminal
gem install bundler

CMD gem install bundler

Wait for a few second, if you don’t see any errors, we are ready to create our first project.

Jekyll on Linux

Although I’m using Fedora distro, I create this tutorial on Ubuntu 17.04 because Ubuntu is still one of the most popular distros and one of the most intuitive for a non-Linux user.

Can I try to install it on Ubuntu 15 or 16?

Maybe, you can try it, but I do not guarantee that it will work well.

First of all, we need to certificate that we have the newest version of our package and their dependencies.

# Copy and paste or type the code below on your terminal
sudo apt-get update

Terminal ubuntu apt-get

After that, we’re ready to install Ruby and all its dependencies, libraries, make and gcc.

Installing Ruby on Linux

To install Ruby and its dependencies.

# Copy and paste or type the code below on your terminal
sudo apt-get install ruby ruby-dev make gcc

Wait a few minutes.

Terminal ubuntu apt-get install ruby ruby-dev make gcc

If you don’t see any errors, we’re ready to install Jekyll and Bundler.

Installing Jekyll and Bundler on Linux

To install Jekyll and Bundler, it’s pretty simple.

# Copy and paste or type the code below on your terminal
sudo gem install jekyll bundler

That could take a while, be patience.

Terminal ubuntu sudo gem install jekyll bundler

If you don’t see any errors, we are ready to create our first project.

Jekyll on Mac

Last but no least, I’ve used Mac OS X Sierra to install Jekyll.

Can I try to install it on El Capitan or Mavericks?

You can try it, but I don’t guarantee that it will work.

Installing XCODE

To run Jekyll on Mac OS X we need to install the Xcode. The Xcode has 4GB to download, but we don’t need the entirely Xcode unless you need it to programming in object-c or swift.

All we need it’s just Xcode command line tools. To install it open your terminal and type:

# Copy and paste or type the code below on your terminal
xcode-select --install

Terminal OS X xcode-select --install

It will appear a message saying: “The xcode-select command requires the command line developer tools. Would you like to install the tools now?” Press “Install” and wait a few minutes.

Installing Ruby with RVM

Now, we need to install the rvm “Ruby Version Manage”; Go to rvm website.

# Copy and paste or type the code below on your terminal
\curl -sSL https://get.rvm.io | bash -s stable

Terminal OS X \curl -sSL https://get.rvm.io | bash -s stable

After that, we need to run a script to use the RVM.

# Copy and paste or type the code below on your terminal
source /Users/YourUserName/.rvm/scripts/rvm

Terminal OS X source /Users/YourUserName/.rvm/scripts/rvm

Now we need to install Ruby.

# Copy and paste or type the code below on your terminal
rvm install ruby-2.4.1

Terminal OS X rvm install ruby

During the process, RVM will also install the Homebrew, press Enter to continue the installation.

Homebrew is a package manager for Mac OS X as the Chocolatey is for Windows.

Terminal OS X homebrew install

Installing Jekyll and Bundler on Mac OS X

To install Jekyll, it’s simple.

# Copy and paste or type the code below on your terminal
gem install jekyll

Terminal OS X jekyll

Wait a few minutes and if you don’t see any errors, we’re ready to install Bundler.

# Copy and paste or type the code below on your terminal
gem install bundler

Terminal OS X bundler

If you don’t see any errors, we are ready to create our first project.

Creating our first project

Now we need to choose a place to create our project. In this example, I’ll create the project in my Documents folder, but you can create your project whatever you want.

Considering that you already are in Documents folder or in the folder that you choose.

# Copy and paste or type the code below on your terminal
# Since myblog is the name of our project folder.
jekyll new myblog

Wait a few minutes until complete it. If you don’t see any errors, we need to enter into our project folder.

# Copy and paste or type the code below on your terminal
# Once again, myblog is the name of our folder.
cd myblog

Running Jekyll

Into the myblog folder type.

# Copy and paste or type the code below on your terminal
jekyll serve

Windows Windows Jekyll s

Linux Linux Jekyll s

Mac Mac OS X Jekyll s

Take this http://127.0.0.1:4000/ address and paste it into your favorite browser and see your first website/blog/portfolio running for the very first time.

On browser

Thank you guys for reading this article, I’ll hope you enjoy it, any question about these installations, leave a message below.