Consider the following version of the Stone-Weierstrass Approximation theorem (from Royden - Real Analysis)
The Stone-Weierstrass Approximation Theorem Let $X$ be a compact Hausdorff space. Suppose $\mathcal{A}$ is an algebra of continuous real-valued functions on $X$ that separates points in $X$ and contains the constant functions. Then $\mathcal{A}$ is dense in $C(X)$.
Consider also the following approximation theorem from enter link description here
3.14 Theorem For $1 \leq p < \infty$, $C_c(X)$ is dense in $L^p(\mu)$.
There's a key difference between the two theorems, in the Stone-Weierstrass theorem $X$ is a compact Hausdorff space while in Rudin's $X$ is a locally compact Hausdorff space.
This which makes me suspect it's probably not possible to approximate elements of $L^p(\mu)$ with element of some algebra in $C_c(X)$ (when $X$ is only locally compact).
However if $X$ is compact then is also locally compact so in that case it can work, but I wonder what if is just locally compact but not compact.