Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shorten mktemp flag for macOS #4491

Merged
merged 1 commit into from Jan 29, 2021
Merged

Shorten mktemp flag for macOS #4491

merged 1 commit into from Jan 29, 2021

Conversation

jamesottaway
Copy link
Contributor

I noticed (via numtide/devshell#10) that nix develop calls mktemp with a set of flags which don't run correctly on macOS.

❯ nix develop
warning: Git tree '/Users/jamesottaway/.dotfiles' is dirty
mktemp: illegal option -- -
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix

[.dotfiles]$

I was originally worried that it'd be a big change, but I found other mktemp calls around this repo where the shorter -t flag is used. I can confirm that the combination of -d -t flags works fine on macOS:

❯ uname -v
Darwin Kernel Version 19.6.0: Tue Nov 10 00:10:30 PST 2020; root:xnu-6153.141.10~1/RELEASE_X86_64

❯ mktemp -d --tmpdir nix-shell.XXXXXX
mktemp: illegal option -- -
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix

❯ mktemp -d -t nix-shell.XXXXXX
/var/folders/11/n6zrq3m97qx1_rjmgjx4n3pm0000gp/T/nix-shell.XXXXXX.ok7Llubr

Address `mktemp: illegal option -- -`.
@domenkozar domenkozar merged commit ab31513 into NixOS:master Jan 29, 2021
@jamesottaway jamesottaway deleted the patch-1 branch January 31, 2021 22:47
@mfouesneau
Copy link

I have this issue when trying to run for instance, cc.

What's the fix?
nix (Nix) 2.17.0
mac os 13.5.1

@DavidPeet8
Copy link

@mfouesneau installing mktemp through nix so that it shadows the native version solved this for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants