Quickest and easiest way is to thread together a new outer with the old using a reverb hose barb tool and then push the old out with the new (from the rear). But depending on its condition and how well/smoothly the old cable is routed you may still need to drop the motor in order for the new cable to follow the old one smoothly.
If that's the case you should be able to just remove 4 T40 motor bolts and let the motor swing from the rear two rather than removing it completely. (after removing the skid plate/plastic guard)
If you remove the chainring from the spider and the shimano chain guide plate from the motor you should be able to reach the motor mounting bolts without the need for the tool to remove the spider. it's still fiddly though. I cut my chain guide's plate years back to turn it into an easily removable open 2 bolt backplate for this very reason.
If you haven't ever replaced the outer and your inner cable is simply now not so smooth but your outer is otherwise undamaged and still in tact here's a quick little hack/tip:
remove your inner gear cable.
Remove the cable end ferrules from each end.
You'll probably find the exposed ends are corroded and strands will be showing
shorten the outer by 10mm ish. (just enough to remove the corroded strands leaving the cable cut nicely again
use a pick to clear the newly cut cable at both ends making sure to have a nice smooth round exit hole.
flush the cable with GT85 or similar
fit new ferrules. (normal plastic ones. not the god awful metal o-ring sealed ones)
and replace the inner cable. Very lighly greased (SRAM butter is decent for this if you happen to have any lying around)
There's generally enough excess outer on most bikes to be able to do this once or twice before replacing the entire outer.