PySpark: "Exception: Java gateway process exited before sending the driver its port number"

I'm trying to run PySpark on my MacBook Air. When I try starting it up, I get the error: Exception: Java gateway process exited before sending the driver its port number when sc = SparkContext() is