Getting Hugo up and running on mac from binary

I downloaded the Darwin amd64 binary from Github, and it didn’t work in accordance with the “Getting Started” docs. I jotted down some grumpy notes: Temporary web page
Hugo is possibly not the easiest software I have installed (as stated on the hugo landing page) - pow rack server gets that gong. I want to help make it easier to install hugo for real (not-so-tech) users. That said, I really do like it.

It could be that a) I’m doing things wrong; or b) I have a technical error with my system; or c) clever tech people have set this up and are very familiar with all that’s needed to get it going, but have forgotten what this is like for new users.

If someone can let me know within what category my problem lies, I’ll gladly write up some docs. in a preferred style to assist others who have difficulty. I would even be prepared over a couple of week to try installation of binaries on several different platforms and document this.

I had some frustration, too. Here are my notes.

I didn’t want to install hugo into /usr/local/bin, so I installed it into my home directory. When I ran it as /Users/quoha/bin/hugo_0.12_darwin_amd64, it produced the following errors:

ERROR: 2014/12/02 Config not found... using only defaults, stuff may not work
ERROR: 2014/12/02 Unable to find Static Directory:  in /Users/quoha/bin/static/
CRITICAL: 2014/12/02 No source directory found, expecting to find it at /Users/quoha/bin/content

When I added $HOME/bin to my path and ran it as hugo_0.12_darwin_amd64, it worked.

I then created a symbolic link from hugo to hugo_0.12_darwin_amd64, but that wasn’t needed. For me, the solution depended only on getting the executable into my path.

The other part that’s missing is that you have to create a new site. That will get rid of the errors that you’re seeing with the content directories.

I guess that would make the installation something like…

  1. Download the Hugo file.
  2. Open the file in Finder.
  3. Locate the executable (it will be named something like hugo_0.12_darwin_amd64).
  4. Decide if you’re going to install it /usr/local/bin or to $HOME/bin
    4a. To install to /usr/local/bin
    sudo mv hugo_[version]_darwin_amd64 /usr/local/bin/hugo
    4b. To install to $HOME/bin
    mkdir $HOME/bin
    mv hugo_[version]_darwin_amd64 $HOME/bin/hugo
  5. Verify that the hugo command is in your path
    hugo help
  6. If you get the expected output, then proceed to setting up a sample site.
  7. Update your environment to add the path to either /usr/local/bin or $HOME/bin
    your explanation works well for this
  8. Repeat step 5

Once hugo is installed and you’ve verified with the hugo help command, create a sample site.

$ cd ~/Sites
$ hugo new site sample
$ ll sample
total 8
drwxr-xr-x   7 quoha  staff  238 Dec  2 10:39 .
drwxr-xr-x  20 quoha  staff  680 Dec  2 10:39 ..
drwxr-xr-x   2 quoha  staff   68 Dec  2 10:39 archetypes
-rw-r--r--   1 quoha  staff   82 Dec  2 10:39 config.toml
drwxr-xr-x   2 quoha  staff   68 Dec  2 10:39 content
drwxr-xr-x   2 quoha  staff   68 Dec  2 10:39 layouts
drwxr-xr-x   2 quoha  staff   68 Dec  2 10:39 static

Then test hugo

$ cd ~/Sites/sample
$ hugo server --watch
0 draft content 
0 future content 
0 pages created 
0 tags created
0 categories created
in 2 ms
Watching for changes in /Users/quoha/Sites/sample/content
Serving pages from /Users/quoha/Sites/sample/public
Web Server is available at http://localhost:1313
Press ctrl+c to stop

One other thing popped up when I first tried Hugo. The hugo new post/ command on a new site (one that has the default archetypes) will create the post as a draft.

date = "2014-12-02T10:51:45-06:00"
draft = true
title = "sample"


Hugo won’t build drafts unless you tell it to. Very confusing at first.

0 of 1 draft rendered 
0 future content 
0 pages created 
0 tags created
0 categories created
in 2 ms

You can tell it to, or you can delete the draft line (or set it to false).

$ hugo --buildDrafts
1 of 1 draft rendered 
0 future content 
1 pages created 
0 tags created
0 categories created
in 2 ms

Please help us make the documentation better. We’d love the best possible experience for our users.

On Mac you can also just brew install hugo if you want to use a package manager.