This is mainly a note for myself. Ran into a scenario where I needed to extract the private key from a PFX file, this is the command to run (on OS X).

  openssl pkcs12 -in  file.pfx -nocerts -out file.pem -nodes

Now extract the certificate

  openssl pkcs12 -in  file.pfx -nokeys -out certificate.crt