  Long-duration $\gamma$-ray bursts (GRBs) accompany the collapse of massive
stars and carry information about the central engine. However, no 3D models
have been able to follow these jets from their birth by a black-hole (BH) to
the photosphere. We present the first such 3D general-relativity
magnetohydrodynamic simulations, which span over 6 orders of magnitude in space
and time. The collapsing stellar envelope forms an accretion disk, which drags
inwardly the magnetic flux that accumulates around the BH, becomes dynamically
important and launches bipolar jets. The jets reach the photosphere at
$\sim10^{12}$ cm with an opening angle $\theta_j\sim6^\circ$ and a Lorentz
factor $\Gamma_j\lesssim 30$, unbinding $\gtrsim90\%$ of the star. We find that
(i) the disk-jet system spontaneously develops misalignment relative to the BH
rotational axis. As a result, the jet wobbles with an angle
$\theta_t\sim12^\circ$, which can naturally explain quiescent times in GRB
lightcurves. The effective opening angle for detection $\theta_j+\theta_t$
suggests that the intrinsic GRB rate is lower by an order of magnitude than
standard estimates. This suggests that successful GRBs may be rarer than
currently thought and emerge in only $\sim 0.1\%$ of supernovae Ib/c, implying
that jets are either not launched or choked inside most supernova Ib/c
progenitors. (ii) The magnetic energy in the jet decreases due to mixing with
the star, resulting in jets with a hybrid composition of magnetic and thermal
components at the photosphere, where $\sim 10\%$ of the gas maintains
magnetization $\sigma\gtrsim 0.1$. This indicates that both a photospheric
component and reconnection may play a role in the prompt emission.
