If this has happened to you, here’s quick method to help force it out.
Open Terminal.
Enter the one Terminal command below that applies to you and press enter. For single optical drives: For internal optical drives: For external optical drives:
Your CD or DVD should be ejected.
Quit Terminal. Note: If the above method does not work, here are some other solutions to help force out a CD/DVD that is stuck in your Mac. Image Credit: splorp