Documentation

Welcome to the Hexo documentation. If you encounter any problems when using Hexo, have a look at the troubleshooting guide, raise an issue on GitHub or start a topic on the Google Group.

What is Hexo?

Hexo is a fast, simple and powerful blog framework. You write posts in Markdown (or other languages) and Hexo generates static files with a beautiful theme in seconds.

Installation

It only takes a few minutes to set up Hexo. If you encounter a problem and can’t find the solution here, please submit a GitHub issue and I’ll try to solve it.

Requirements

Installing Hexo is quite easy and only requires the following beforehand:

  • Node.js (Should be at least Node.js 8.6, recommends 10.0 or higher)
  • Git

If your computer already has these, congratulations! You can skip to the Hexo installation step.

If not, please follow the following instructions to install all the requirements.

For Mac users

You may encounter some problems when compiling. Please install Xcode from App Store first. After Xcode is installed, open Xcode and go to Preferences -> Download -> Command Line Tools -> Install to install command line tools.

For Mac / Linux users

If you are a macOS user, or a Linux user who install Node.js through your package manager with default repository, you might run into some permission error when using npm install -g. Please follow the guide provided by npmjs to solve the issue, AND DO NOT USE ROOT USER OR SUDO TO OVERRIDE.

Install Git

  • Windows: Download & install git.
  • Mac: Install it with Homebrew, MacPorts or installer.
  • Linux (Ubuntu, Debian): sudo apt-get install git-core
  • Linux (Fedora, Red Hat, CentOS): sudo yum install git-core

Install Node.js

  • Windows: Install it with nvs (recommended) or nvm. (Either also support Mac and Linux)
  • Mac: Install it with Homebrew or MacPorts.
  • Linux (DEB/RPM-based): Install it with NodeSource.
  • Linux (other): Install it through respective package manager (if Node.js >= 10.0 is available) or use the installation scripts mentioned in Windows.

Alternatively, download and run the official installer provided by Node.js.

Install Hexo

Once all the requirements are installed, you can install Hexo with npm:

$ npm install -g hexo-cli

Advanced installation and usage

Advanced users may prefer to install and use hexo package instead.

$ npm install hexo

Once installed, you can run Hexo in two ways:

  1. npx hexo <command>

  2. Linux users can set relative path of node_modules/ folder:

    echo 'PATH="$PATH:./node_modules/.bin"' >> ~/.profile

    then run Hexo using hexo <command>