How to disconnect from wifi on Mac OS X

Solution 1:

Hold down the option key when you click on the WiFi menu. Then next to the currently active network there will be a "Disconnect from" option. I'm on Yosemite, and so I'm not sure whether this was present on earlier versions of OS X.

enter image description here

Solution 2:

Or you can use Terminal:

Instead of "DEVICE_NAME" use your interface (i.g.: en0)

sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport "DEVICE_NAME" -z