ModuleNotFoundError: No module named 'pasteboard'

I've just installed rust on MacOS (intel) via

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

and I'm trying to compile an example program

fn main() {
  println!("Hello World!");
}

but rustc example.rs yields

error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-arch" "x86_64" "-m64" "/var/folders/4w/n0_41y251ld3zzgs_lx6gkq80000gn/T/rustc2CCo0A/symbols.o" "example.example.2988d036-cgu.0.rcgu.o" "example.example.2988d036-cgu.1.rcgu.o" "example.example.2988d036-cgu.2.rcgu.o" "example.example.2988d036-cgu.3.rcgu.o" "example.example.2988d036-cgu.4.rcgu.o" "example.example.2988d036-cgu.5.rcgu.o" "example.lwoe1858kj3f8ad.rcgu.o" "-L" "/Users/emile/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/emile/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-b80af3af0eb55523.rlib" "/Users/emile/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-41e0d9e950b571e9.rlib" "/Users/emile/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libobject-65b358c31ecfc4a1.rlib" "/Users/emile/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libmemchr-d704bb0c865e41a0.rlib" "/Users/emile/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libaddr2line-86367ac319ee82d9.rlib" "/Users/emile/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libgimli-377d8495d8a9283b.rlib" "/Users/emile/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-204129267883501a.rlib" "/Users/emile/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd_detect-718604cf3d9431db.rlib" "/Users/emile/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libhashbrown-07b15630ccf51366.rlib" "/Users/emile/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libminiz_oxide-af6869cacce7810c.rlib" "/Users/emile/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libadler-93f8c992dd4fe422.rlib" "/Users/emile/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_alloc-9838a33e4eec9cf7.rlib" "/Users/emile/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-9f7f7415b21b2c00.rlib" "/Users/emile/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcfg_if-177ca04931a429cc.rlib" "/Users/emile/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-47bcfebe3e84a4ab.rlib" "/Users/emile/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-b6cf8e9c2b704fbc.rlib" "/Users/emile/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-030bef4529720381.rlib" "/Users/emile/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-e5bf6795ffb21202.rlib" "/Users/emile/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-315ef7713cc82d0e.rlib" "-lSystem" "-lresolv" "-lc" "-lm" "-liconv" "-L" "/Users/emile/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "-o" "example" "-Wl,-dead_strip" "-nodefaultlibs"
  = note: Traceback (most recent call last):
            File "/Users/emile/bin/cc", line 4, in <module>
              import pasteboard
          ModuleNotFoundError: No module named 'pasteboard'
1 Like

Your C compiler installation seems to be messed up. cc points to an unusual location. On Unix-like systems, it's usually under /usr/bin or /usr/local/bin, on macOS it might also be under /Library/Developer/CommandLineTools/usr/bin or /Applications/Xcode.app/…. It also seems to be replaced by a Python script. You'll need to fix your C toolchain.

2 Likes

That was it -- a python script in my PATH by the name of cc. Renamed that, works now, thanks!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.