  In this paper, first we give the notion of a crossed homomorphism on a 3-Lie
algebra with respect to an action on another 3-Lie algebra, and characterize it
using a homomorphism from a Lie algebra to the semidirect product Lie algebra.
We also establish the relationship between crossed homomorphisms and relative
Rota-Baxter operators of weight 1 on 3-Lie algebras. Next we construct a
cohomology theory for a crossed homomorphism on 3-Lie algebras and classify
infinitesimal deformations of crossed homomorphisms using the second cohomology
group. Finally, using the higher derived brackets, we construct an
$L_\infty$-algebra whose Maurer-Cartan elements are crossed homomorphisms.
Consequently, we obtain the twisted $L_\infty$-algebra that controls
deformations of a given crossed homomorphism on 3-Lie algebras.
