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.
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.
Installing Hexo is quite easy. However, you do need to have a couple of other things installed first:
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.
- 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
The best way to install Node.js is with Node Version Manager.
Thankfully the creators of nvm provide a simple script that automatically installs nvm:
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
$ wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
Once nvm is installed, restart the terminal and run the following command to install Node.js:
$ nvm install stable
Once all the requirements are installed, you can install Hexo with npm:
$ npm install -g hexo-cli
Advanced users may prefer to install and use
hexo package instead.
$ npm install hexo
Once installed, you can run Hexo in two ways:
npx hexo <command>
Linux users can set relative path of
echo 'PATH="$PATH:./node_modules/.bin"' >> ~/.profile
then run Hexo using