Separability of functions with compact support

Your idea is good, and you must only take a little more care for it to work. As you said, if $K$ is a compact metric space, then $C(K)$ is separable.

Now, suppose that $X$ is is a locally compact, $\sigma$-compact metric space. You can find a sequence $\left\{K_n\right\}_{n\in\mathbb{N}}$ of compact subsets of $X$ satisfying:

  1. $K_n\subseteq\text{int}K_{n+1}$ for every $n$;

  2. $X=\bigcup_{n\in\mathbb{N}}K_n$.

For every $n$, let $C_n=\left\{f\in C_c(X):\text{supp}f\subseteq K_n\right\}$. Notice that $C_c(X)=\bigcup_{n\in\mathbb{N}}C_n$, so it is sufficient to show that each $C_n$ is separable.

Fixed $n$, consider the function $R_{K_n}:C_n\rightarrow C(K_n)$, $f\mapsto f|_{K_n}$. This is a linear isometry (not necessarily surjective), so $R_{K_n}(C_n)$ is a subspace of the separable space $C(K_n)$, so it is also separable, hence $C_n$ is also separable.