diff --git a/Cargo.toml b/Cargo.toml
index 8960942..15b013d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,6 +20,8 @@ alpn = ["security-framework/alpn"]
security-framework = "2.0.0"
security-framework-sys = "2.0.0"
libc = "0.2"
+
+[target.'cfg(target_os = "macos")'.dependencies]
tempfile = "3.1.0"
[target.'cfg(target_os = "windows")'.dependencies]
diff --git a/src/imp/security_framework.rs b/src/imp/security_framework.rs
index 63232b7..1f704bc 100644
--- a/src/imp/security_framework.rs
+++ b/src/imp/security_framework.rs
@@ -1,7 +1,6 @@
extern crate libc;
extern crate security_framework;
extern crate security_framework_sys;
-extern crate tempfile;
use self::security_framework::base;
use self::security_framework::certificate::SecCertificate;
@@ -12,7 +11,6 @@ use self::security_framework::secure_transport::{
self, ClientBuilder, SslConnectionType, SslContext, SslProtocol, SslProtocolSide,
};
use self::security_framework_sys::base::{errSecIO, errSecParam};
-use self::tempfile::TempDir;
use std::error;
use std::fmt;
use std::io;
@@ -38,7 +36,7 @@ use {Protocol, TlsAcceptorBuilder, TlsConnectorBuilder};
static SET_AT_EXIT: Once = Once::new();
#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos")))]
-static TEMP_KEYCHAIN: Mutex