How do I fix the error “couldn't load codegen backend” on macOS?

main.rs:

fn main() {
    println!("Hello world!");
}
$ rustc main.rs:
error: couldn't load codegen backend "/usr/local/lib/rustlib/i686-apple-darwin/codegen-backends/librustc_codegen_llvm-llvm.dylib": "dlsym(RTLD_DEFAULT, CFURLConnectionCreateWithProperties): symbol not found"

I'm using macOS(10.11.6) with Rust 1.30.1 and gcc Apple LLVM version 8.0.0 (clang-800.0.42.1) .

If somebody wants some sweet SO reputation:
https://stackoverflow.com/questions/53587933/how-do-i-fix-the-error-couldnt-load-codegen-backend-on-macos