Skip to content

Shorten mktemp flag for macOS - #4491

Merged
domenkozar merged 1 commit into
NixOS:masterfrom
jamesottaway:patch-1
Jan 29, 2021
Merged

domenkozar merged 1 commit into
NixOS:masterfrom
jamesottaway:patch-1

Conversation

@jamesottaway

Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown

@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.

4 participants