Docs: Install Jekyll on macOS (#6881)

Merge pull request 6881
This commit is contained in:
Frank Taillandier 2018-04-12 21:45:34 +02:00 committed by jekyllbot
parent 551037c37b
commit 7dc4d4fd67
2 changed files with 122 additions and 88 deletions

View File

@ -9,6 +9,7 @@ note: This file is autogenerated. Edit /History.markdown instead.
### Bug Fixes
{: #bug-fixes-v3-7-3}
- Do not hardcode locale unless certainly necessary ([#6791]({{ site.repository }}/issues/6791))

View File

@ -1,65 +1,145 @@
---
title: Installation
description: Official guide to install Jekyll on macOS, GNU/Linux or Windows.
permalink: /docs/installation/
---
Getting Jekyll installed and ready-to-go should only take a few minutes.
If it ever becomes a pain, please [file an issue]({{ site.repository }}/issues/new)
(or submit a pull request) describing the issue you
encountered and how we might make the process easier.
- [Requirements](#requirements)
- [Install on macOS](#macOS)
- [Install on Windows](../windows/)
- [Upgrade Jekyll](#upgrade-jekyll)
### Requirements
Installing Jekyll should be straight-forward if your system meets the requirements.
## Requirements
Installing Jekyll should be straight-forward if all requirements are met.
Before you start, make sure your system has the following:
- GNU/Linux, Unix, or macOS
- [Ruby](https://www.ruby-lang.org/en/downloads/) version 2.2.5 or above, including all development
headers (ruby installation can be checked by running `ruby -v`, development headers can be checked on Ubuntu by running `apt list --installed ruby-dev`)
- [Ruby](https://www.ruby-lang.org/en/downloads/) version 2.2.5 or above, including all development headers (ruby installation can be checked by running `ruby -v`)
- [RubyGems](https://rubygems.org/pages/download) (which you can check by running `gem -v`)
- [GCC](https://gcc.gnu.org/install/) and [Make](https://www.gnu.org/software/make/) (in case your system doesn't have them installed, which you can check by running `gcc -v`,`g++ -v` and `make -v` in your system's command line interface)
<div class="note info">
<h5>Problems installing Jekyll?</h5>
<p>
Check out the <a href="../troubleshooting/">troubleshooting</a> page or
<a href="{{ site.repository }}/issues/new">report an issue</a> so the
Jekyll community can improve the experience for everyone.
</p>
</div>
## Install on macOS {#macOS}
<div class="note info">
<h5>Running Jekyll on Windows</h5>
<p>
While Windows is not officially supported, it is possible to get Jekyll running
on Windows. Special instructions can be found on our
<a href="../windows/#installation">Windows-specific docs page</a>.
</p>
</div>
We only cover macOS High Sierra 10.13 here, which comes with Ruby 2.3.3, older systems will need to [install a more recent Ruby version via Homebrew](#homebrew).
## Install with RubyGems
The best way to install Jekyll is via
[RubyGems](https://rubygems.org/pages/download). At the terminal prompt,
simply run the following command to install Jekyll:
First, you need to install the command-line tools to be able to compile native extensions, open a terminal and run:
```sh
gem install jekyll
xcode-select --install
```
All of Jekylls gem dependencies are automatically installed by the above
command, so you wont have to worry about them at all.
### Set up Ruby included with the OS
Check your Ruby version meet our requirements:
```sh
ruby -v
2.3.3
```
Great, let's install Jekyll. We also need [Bundler](https://bundler.io/) to help us handle [plugins](../plugins) and [themes](../themes):
```sh
gem install bundler jekyll
```
That's it, you're ready to go, either by installing our [default minimal blog theme](https://github.com/jekyll/minima) with `jekyll new jekyll-website` or by starting from scratch:
```sh
mkdir jekyll-website
cd jekyll-website
# Create a Gemfile
bundle init
# Add Jekyll
bundle add jekyll
# Install gems
bundle install
```
Great, from there you can now either use a [theme](../themes/) or [create your own layouts](../templates/).
### Install a newer Ruby version via Homebrew {#homebrew}
If you wish to install the latest version of Ruby and get faster builds, we recommend to do it via [Homebrew](https://brew.sh) a handy package manager for macOS.
```sh
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install ruby
ruby -v
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
```
Yay! Now you have a shiny Ruby on your system!
### Install multiple Ruby versions with rbenv {#rbenv}
Developers often use [rbenv](https://github.com/rbenv/rbenv) to manage multiple Ruby versions. This can be useful if you want to run the same Ruby version used by [GitHub Pages](https://pages.github.com/versions/) or [Netlify](https://www.netlify.com/docs/#ruby) for instance.
```sh
# Install rbenv and ruby-build
brew install rbenv
# Setup rbenv integration to your shell
rbenv init
# Check your install
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash
```
Restart your terminal for changes to take effect.
Now we can install the Ruby version of our choice, let's go with Ruby 2.5.1 here:
```sh
rbenv install 2.5.1
rbenv global 2.5.1
ruby -v
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
```
That's it! Head over [rbenv command references](https://github.com/rbenv/rbenv#command-reference) to learn how to use different versions of Ruby in your projects.
<div class="note info" markdown="1">
##### Problems installing Jekyll?
Check out the [troubleshooting](../troubleshooting/) page or
[ask for help on our forum](https://talk.jekyllrb.com).
<div class="note info">
<h5>Installing Xcode Command-Line Tools</h5>
<p>
If you run into issues installing Jekyll's dependencies which make use of
native extensions and are using macOS, you will need to install Xcode
and the Command-Line Tools it ships with. Download them in
<code>Preferences &#8594; Downloads &#8594; Components</code>.
</p>
</div>
## Upgrade Jekyll
Before you start developing with Jekyll, you may want to check that you're up to date with the latest version. To find the currently installed version of Jekyll, run one of these commands:
```sh
jekyll --version
gem list jekyll
```
You can use RubyGems to find [the current version of Jekyll](https://rubygems.org/gems/jekyll). Another way to check if you have the latest version is to run the command `gem outdated`. This will provide a list of all the gems on your system that need to be updated. If you aren't running the latest version, run this command:
```sh
bundle update jekyll
```
Alternatively, if you don't have Bundler installed run:
```sh
gem update jekyll
```
To upgrade to latest Rubygems, run:
```
gem update --system
```
Refer to our [upgrading section](../upgrading/) to upgrade from Jekyll 2.x or 1.x.
## Pre-releases
In order to install a pre-release, make sure you have all the requirements
@ -88,51 +168,4 @@ bundle exec rake build
ls pkg/*.gem | head -n 1 | xargs gem install -l
```
## Optional Extras
There are a number of (optional) extra features that Jekyll supports that you
may want to install, depending on how you plan to use Jekyll. These extras
include LaTeX support, and the use of alternative content rendering engines.
Check out [the extras page](../extras/) for more information.
<div class="note">
<h5>ProTip™: Enable Syntax Highlighting</h5>
<p>
If youre the kind of person who is using Jekyll, then chances are youll
want to enable syntax highlighting using <a href="http://pygments.org/">Pygments</a>
or <a href="https://github.com/jayferd/rouge">Rouge</a>. You should really
<a href="../templates/#code-snippet-highlighting">check out how to
do that</a> before you go any farther.
</p>
</div>
## Already Have Jekyll?
Before you start developing with Jekyll, you may want to check that you're up to date with the latest version. To find your version of Jekyll, run one of these commands:
```sh
jekyll --version
gem list jekyll
```
You can also use [RubyGems](https://rubygems.org/gems/jekyll) to find the current versioning of any gem. But you can also use the `gem` command line tool:
```sh
gem search jekyll --remote
```
and you'll search for just the name `jekyll`, and in brackets will be latest version. Another way to check if you have the latest version is to run the command `gem outdated`. This will provide a list of all the gems on your system that need to be updated. If you aren't running the latest version, run this command:
```sh
bundle update jekyll
```
Alternatively, if you don't have Bundler installed run:
```sh
gem update jekyll
```
Please refer to our [upgrading section](../upgrading/) for major updates and detailed instructions.
Now that youve got everything up-to-date and installed, lets get to work!