Switching back and forth between sound outputs in OS X is really easy. For example, you can have a Mac Pro with speakers plugged in the back and headphones jacked into the front.
If you have a Mac with multiple sound output devices and plan on switching between them, you will need to know how to change between those output devices. For example, you may have a Mac Pro with speakers plugged into the line-out, as well as headphones jacked into the port on the front of the tower. Switching sound output devices in Mac OS X is pretty easy.
Click on the Apple logo in the menu bar, located at the top left corner of the screen. In the menu that pulls down, select “System Preferences”.
Once the System Preferences pane loads up, click on “Sound”. If you do not see “Sound”, click the “Show All” button.
Move to the “Output” tab and select your desired output device. Here, “Line Out” is for my speakers and the Built-in Output (Headphones) is for none other than my headphones. Once you have clicked on the desired output device, close the window.