Formation of the free group on $S$ is a functor Example 1.2.4 in Leinster says that an assignment of the free group $\mathcal F(S)$ on $S$ to every set $S$ is a functor. He gives an example of how to assign to a particular function of sets $f:S\to S'$ a homomrphism $F(f):F(S)\to F(S')$ but doesn't give a general proof. So I was wondering how to prove that it is indeed a functor? 
(He doesn't give a rigorous definition of the free group on $S$ either, but let's assume that a formal definition is known (it's the set of equivalence classes of reduced words on the set $S\cup S^{-1}$, where $S^{-1}$ is the set consisting of all symbols $s^{-1}$ for all $s\in S$, with the operation of concatenation).) 
 A: Firstly, just in case you don't know, given a set $S$, the free group $F(S)$ satisfies the following universal property mentioned by @PaulPlummer in the comments. Given a group $G$ and a morphism of sets (i.e. a function) $f\colon S \to G$, there exists a group homomorphism $\phi_f\colon F(S) \to G$ that extends the map $f$. I mean this in the sense that if $i\colon S \to F(S)$ is inclusion, then $\phi_f\circ i = f$ as a set map $S \to G$. Moreover the map $\phi_f$ is unique. I'd draw you a pretty diagram, but it wants a diagonal arrow.
If this is new to you, try proving it!

Now, given a function $f\colon S \to S'$, we want to show that there exists a group homomorphism $F(f) \colon F(S) \to F(S')$ and that the assignment $f \mapsto F(f)$ is functorial. To use the above property, we need a set map $S \to F(S')$. Let $i_{S'} \colon S' \to F(S')$ be the inclusion. We'll use $i_{S'}\circ f$; I claim that the resulting group homomorphism $F(f) := \phi_{i_{S'}\circ f}$ works. Its existence is afforded to us by the universal property. 
To show functoriality, we need to show that the identity function $\operatorname{id}_S\colon S \to S$, is sent to the identity homomorphism $F(\operatorname{id_S}) = \operatorname{id}_{F(S)}$, and that composition is respected, i.e. $F(g\circ f) = F(g)\circ F(f)$.
Both properties are straightforward exercises and left to you. Note the usefulness of the uniqueness statement above!
