diff --git a/.cargo/config.toml b/.cargo/config.toml
index fe26b9b0e..54691e49e 100644
--- a/.cargo/config.toml
+++ b/.cargo/config.toml
@@ -1,7 +1,3 @@
-[target.x86_64-pc-windows-gnu]
-linker = "x86_64-w64-mingw32-gcc"
-ar = "x86_64-w64-mingw32-gcc-ar"
-
 # We need openssl to be statically linked on windows to avoid madness,
 # and openssl-src does that based on the crt-static feature being
 # enabled for the target, so let's turn that on here.
diff --git a/wezterm-mux-server/build.rs b/wezterm-mux-server/build.rs
index 44c7b1204..64c5e95da 100644
--- a/wezterm-mux-server/build.rs
+++ b/wezterm-mux-server/build.rs
@@ -27,10 +27,13 @@ fn main() {
 
         // Obtain MSVC environment so that the rc compiler can find the right headers.
         // https://github.com/nabijaczleweli/rust-embed-resource/issues/11#issuecomment-603655972
-        let target = std::env::var("TARGET").unwrap();
-        if let Some(tool) = cc::windows_registry::find_tool(target.as_str(), "cl.exe") {
-            for (key, value) in tool.env() {
-                std::env::set_var(key, value);
+        #[cfg(target_env = "msvc")]
+        {
+            let target = std::env::var("TARGET").unwrap();
+            if let Some(tool) = cc::windows_registry::find_tool(target.as_str(), "cl.exe") {
+                for (key, value) in tool.env() {
+                    std::env::set_var(key, value);
+                }
             }
         }
         embed_resource::compile(rcfile_name);
