Rustup installation error: command failed: mktemp -d


I'm trying to install Rust on my OS X 10.9.2 Mac.

When I run the command

curl --proto '=https' --tlsv1.2 -sSf | sh

from a bash shell in the terminal, as per Install Rust - Rust Programming Language, I get the error:

james-mbp-4:~ jamespedersen$ curl -sSf | sh
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix 
rustup: command failed: mktemp -d
info: downloading installer
mkdir: : No such file or directory
rustup: command failed: mkdir -p 
james-mbp-4:~ jamespedersen$ 

Any idea as to how to fix this? Is OS-X 10.9 too old for rust? What is the minimum OS-X version that Rust supports?

(Disclaimer: I don't know anything about rustup internals, just poking around in the GitHub repo.)

There is a very similar-looking issue on GitHub from 2016. It was closed in this PR, with this diff:

-   local _dir="$(ensure mktemp -d)"
+   local _dir="$(mktemp -d 2>/dev/null || ensure mktemp -d -t rustup)"

The added line means "try mktemp -d, and if that fails do mktemp -d -t rustup instead, making sure that exits successfully".

However, that change was reverted in a later PR, with the inverse diff:

-   _dir="$(mktemp -d 2>/dev/null || ensure mktemp -d -t rustup)"
+   _dir="$(ensure mktemp -d)"

And I guess that's why you're still running into this problem—it might make sense to open an issue so the maintainers are aware of this. In the meantime, I'd suggest doing curl >, then editing manually to replace ensure mktemp -d with ensure mktemp -d -t rustup, and finally running sh

1 Like

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.