> 20+ years Mac veteran (currently OS X 10.9), but a command line n00b. New
> here too, name's Peter.
>
> Can't figure it out how to clear the 1st hurdle ;-(
>
> Interested in statically generated sites for years, never tried it before.
> Investigated the more popular and finally settled on trying Hugo (fast,
> easy, extensive docs).
> Been reading those docs on install and quickstart over and over again.
> Downloaded 0.12_darwin_amd64 and dropped the executable in a new Hugo
> folder with my other applications (Once downloaded it can be run from
> anywhere.)
>
> Opened Terminal, dragged the executable on the terminal window to provide a
> path, and failed over and over again at all conceivable variations of *hugo
> new site*.
> Running *hugo help* gives what's promised, though, so I know something is
> OK at least.
> But the errors are :
>
> ERROR: 2014/09/07 Config not found... using only defaults, stuff may not
> work
> ERROR: 2014/09/07 Unable to find Static Directory: in
> /Applications/Hugo/static/
> CRITICAL: 2014/09/07 No source directory found, expecting to find it at
> /Applications/Hugo/content
This error message is indicating that the directory that hugo is looking for
its configuration file is missing, and that also there’s other files missing.
This is because your current working dir and the place hugo’s trying to create
stuff in don’t match up.
More info below. I also suggest you see how to copy the screen from your
terminal, and put it up on a site like
http://dpaste.de/ to share a record
of what’s not worked for you if you still get stuck below.
> I figured I should perhaps do something with the */path/to/site* portion of
> the *hugo new site* command, but for me it's just catch 22.
> What do I need to do to generate a site structure in a new folder in my
> Hugo folder ? Please be gentle with me and ELI5 ;-)
>
> TIA !
>
> Peter
Hi Peter,
Welcome :-)
You’re pretty close, I’ll spell this out slowly to make it a bit command-line
friendlier.
I’ll use `backquotes` to indicate typing individual commands in the terminal,
and <angle/brackets> where you need to replace that with content of your
own devising. Longer sections of terminal will be ```fenced``` , as in
https://help.github.com/articles/github-flavored-markdown already shown:
```
a command
# comment to ignore, perhaps some output if useful
another command
```
## Finding hugo
If you open a new terminal window, does just typing `hugo` do anything? This
is making sure it’s in your path. The default PATH is, IIRC, on OSX:
/usr/bin:/bin:/usr/sbin:/usr/local/bin:/usr/X11/bin
A good place for user-installed binaries is in /usr/local/bin/ which you can
create if it doesn’t already exist. Dragging the hugo binary into this folder
is a Good Thing.
The amazing
http://brew.sh tool kit uses /usr/local/bin too, and also allows
simple installation like `brew install hugo` to install a current version of
hugo directly. brew is probably a distraction at this point BTW but it *is*
awesome.
## Changing working Directory
Typically you’ll work in a particular directory, and use a relative path,
so let’s assume you have hugo in /usr/local/bin as before, and that you have
chosen to work in ~/Documents folder.
You can change dir in the terminal with `cd ~/Documents/` and confirm using
`pwd` that the change was successful.
The next sections are basically an expanded version of
http://hugo.spf13.com/overview/quickstart/ so feel free to follow that as
well. If you try the verbatim `hugo /path/to/site` it will fail as most people
don’t have the preceding directories /path/to/ existing. Use something like
~/Documents/ which is on your mac already.
## Generating a site
`hugo new <site>` will create a new directory containing a plain site from
template, and an associated config file, also with some defaults.
Assuming you’ve changed directory already above, you can make a new site
by doing `hugo new mysite` which will create a new directory:
~/Documents/mysite/
From the terminal you can see what files and directories are there using ls:
```
ls -Fl ~/Documents/mysite
# total 8
# drwxr-xr-x+ 2 dch staff 68 7 Sep 22:36 archetypes/
# -rw-r--r--+ 1 dch staff 82 7 Sep 22:36 config.toml
# drwxr-xr-x+ 2 dch staff 68 7 Sep 22:36 content/
# drwxr-xr-x+ 2 dch staff 68 7 Sep 22:36 layouts/
# drwxr-xr-x+ 2 dch staff 68 7 Sep 22:36 static/
```
the handy -F switch puts an extra character at the end of anything that isn’t
a simple file.
Before doing anything more, we need to change the current working directory,
inside ~/Documents at the moment, to be inside mysite.
We can do this either using a relative path `cd mysite` or the longer
`cd ~/Documents/mysite`, and check our location with `pwd` at the end.
## A first post
So now we are “inside” our site dir, but it’s empty. The next stage is to make
a page within that site, and then we can generate the site to see our awesome
powers at work.
```
pwd
# should see ~/Documents/mysite/ or similar
hugo new about.md
# ~/Documents/mysite/content/about.md created
# check it with `cat ~/Documents/mysite/content/about.md`
# +++
# date = "2014-09-07T22:47:35+02:00"
# draft = true
# title = "about"
# +++
```
That’s a good starting point if you get thus far.
—
Dave Cottlehuber
d...@jsonified.com
Sent from my Couch