We calculate, within the NRQCD factorization formalism, the leading color-octet contributions to ψ production in photon-nucleon and electron-nucleon collisions. The expressions we obtaine depend on the NRQCD matrix elements [Formula: see text] and [Formula: see text]. These matrix elements can be determined by fitting to experimental data. The color-octet contribution to ψ photoproduction is in the forward region of phase space, where there may be large corrections to the NRQCD result from higher twist terms. As to ψ leptoproduction we point out that the theoretical uncertainties plaguing the photoproduction calculation vanish in the large momentum transfer limit. In this region of phase space the NRQCD formalism should be valid, making ψ leptoproduction an ideal laboratory for testing the theory.