mac install jekyll

mac install jekyll

Jekyll Introduction

JekyllIt is a project that transforms plain text into static websites and blogs. The official website description is like this:

`Jekyll`   `Markdown`   `Textile`    `Liquid`  `Jekyll`   `GitHub Page`   `GitHub`  
 

Jekyll installation

premise

Installation Jekyllis very simple, but you have to do some preparation in advance, to ensure your machine is configured

Note: To use Jekyll under windows, you can use Running Jekyll on Windows

installation

With RubyGemsthe installationJekyll

Installation JekyllThe best way is to use RubyGemsyou only need to open a terminal and enter the following command can be installed:

    sudo gem install jekyll
 

All Jekyll's gem dependency packages will be installed automatically, so you don't have to worry about it at all. If you encounter problems during installation.

Note: Macyou need to install Xcodeand Command-Line Toolsup. Download method Preferences Downloads Components.

Initialize the project

Open the terminal and find the directory you like to execute

    jekyll new projectName[ ]
 

Startup project

The terminal points to the newly initialized project directory, and then execute

    jekyll server
 

Under normal circumstances, the following content will be output

    Configuration file: /Users/[ ]/StudyCloud/Blog/myblog/_config.yml
                Source: /Users/[ ]/StudyCloud/Blog/myblog
           Destination: /Users/[ ]/StudyCloud/Blog/myblog/_site
     Incremental build: disabled. Enable with --incremental
          Generating... 
                        done in 0.382 seconds.
     Auto-regeneration: enabled for '/Users/lane/StudyCloud/Blog/myblog'
        Server address: http://127.0.0.1:4000/
      Server running... press ctrl-c to stop.
 

Start service is listening 4000ports.

If it is an abnormal situation, the following may be output

/usr/local/Cellar/ruby/2.4.3_1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- bundler (LoadError)
	from/usr/local/Cellar/ruby/2.4.3_1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from/usr/local/lib/ruby/gems/2.4.0/gems/jekyll-3.6.2/lib/jekyll/plugin_manager.rb:48:in `require_from_bundler'
	from/usr/local/lib/ruby/gems/2.4.0/gems/jekyll-3.6.2/exe/jekyll:11:in `<top (required)>'
	from/usr/local/bin/jekyll:23:in `load'
	from/usr/local/bin/jekyll:23:in `<main>'
lanedeMacBook-Pro:myblog [ ]$ gem install bundler
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the/Library/Ruby/Gems/2.3.0 directory.
 

If the abnormal situation is consistent with this, then the problem is solved.

  • 1, the first sentence is saying bundlerthis package was not found. If it is not found, install one and execute the command sudo gem install bundler.

  • 2. After installation, I can not wait to perform a bit jekyll serverand found an error

/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler/resolver.rb:289:in `block in verify_gemfile_dependencies_are_found!': Could not find gem 'minima (~> 2.0)' in any of the gem sources listed in your Gemfile. (Bundler::GemNotFound)
	from/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler/resolver.rb:257:in `each'
	from/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler/resolver.rb:257:in `verify_gemfile_dependencies_are_found!'
	from/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler/resolver.rb:48:in `start'
	from/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler/resolver.rb:22:in `resolve'
	from/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler/definition.rb:257:in `resolve'
	from/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler/definition.rb:170:in `specs'
	from/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler/definition.rb:237:in `specs_for'
	from/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler/definition.rb:226:in `requested_specs'
	from/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:108:in `block in definition_method'
	from/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:20:in `setup'
	from/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler.rb:107:in `setup'
	from/usr/local/lib/ruby/gems/2.4.0/gems/jekyll-3.6.2/lib/jekyll/plugin_manager.rb:50:in `require_from_bundler'
	from/usr/local/lib/ruby/gems/2.4.0/gems/jekyll-3.6.2/exe/jekyll:11:in `<top (required)>'
	from/usr/local/bin/jekyll:23:in `load'
	from/usr/local/bin/jekyll:23:in `<main>'
 
  • 3. This error is getting more and more terrifying. Although it is terrible, there is always a solution, continue to implementbundle update

  • 4, the command has completed, then execution bundle exec jekyll serveor jekyll serveOK.