Hi!
I’m working on nix-ifying macOS and have learned a lot so far. Most recently I’m stuck on installing apps from the Mac App Store via the Homebrew integration. Installation via environment.systemPackages
and homebrew.casks
works as expected. Only MAS installation/integration seems partially busted.
The chosen application is added to /Applications
but the process appears to hang on the first application configured. Whether I have one application or n
, the same thing happens. Regardless of which app I specify. If I run mas
interactively from the command line, it will install the app and exit 0
as expected.
I also attempted to increase verbosity (darwin-rebuild switch --show-trace -vvv
) but it didn’t appear to provide any additional information to this problem. A look in Console.app
was more or less unparsable for me.
Additionally, I’m attempting to rely on pkgs.mas
, instead of letting brew
install it (see this). In an attempt to resolve this I did try letting brew install mas
but it didn’t help and seemingly attempted to reinstall mas
every time switch
was ran.
I’m on macOS 15.3.1
and Apple Silicon
. If I can provide any additional detail please let me know and I would be happy to.
Thanks in advanced!
Logs:
# darwin-rebuild switch
building the system configuration...
warning: Git tree '/Volumes/my-data/Developer/nix-configs' is dirty
setting up Homebrew (/Volumes/nix-homebrew/opt/homebrew)...
setting up Homebrew (/opt/homebrew)...
user defaults...
restarting Dock...
setting up user launchd services...
Homebrew bundle...
Using blockblock
...
Installing Link Unshortener
# ** here it hangs ***
The application does exist now:
❯ ls /Applications
...
drwxr-xr-x 3 root wheel 96 Feb 24 11:37 Link Unshortener.app
...
Sample from my config:
# flake.nix
...
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-24.11-darwin";
...
nix-darwin = {
url = "github:LnL7/nix-darwin/nix-darwin-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
...
# zhaofengli-wip/nix-homebrew
nix-homebrew.url = "github:zhaofengli-wip/nix-homebrew";
homebrew-core = {
url = "github:homebrew/homebrew-core";
flake = false;
};
homebrew-cask = {
url = "github:homebrew/homebrew-cask";
flake = false;
};
homebrew-bundle = {
url = "github:homebrew/homebrew-bundle";
flake = false;
};
};
...
----
# darwin.nix
nix-homebrew.enable = true; # https://github.com/zhaofengli/nix-homebrew
homebrew.enable = true;
nix-homebrew = {
#@todo don't install at default location
mutableTaps = false;
enableRosetta = false;
taps = {
"homebrew/homebrew-bundle" = inputs.homebrew-bundle;
};
user = username;
prefixes = {
"${homebrew-prefix}" = {
enable = true;
library = "${homebrew-prefix}/Library";
taps = {
"homebrew/homebrew-cask" = inputs.homebrew-cask;
"homebrew/homebrew-bundle" = inputs.homebrew-bundle;
};
};
};
};
homebrew = {
brewPrefix = "${homebrew-prefix}/bin";
caskArgs.appdir = "${homebrew-volume}/Applications";
caskArgs.no_binaries = true;
caskArgs.no_quarantine = false;
caskArgs.require_sha = true;
global.autoUpdate = false;
onActivation.autoUpdate = false;
onActivation.cleanup = "uninstall"; # set 'zap' global and uninstall per 'app'?
onActivation.upgrade = true;
brews = pkgs.lib.mkForce [ ]; # https://github.com/LnL7/nix-darwin/pull/1329
};
environment.systemPackages = with pkgs; [
...
pkgs.mas # https://github.com/LnL7/nix-darwin/pull/1329
...
];
homebrew.casks = [
...
];
homebrew.masApps = {
...
"Link Unshortener" = 1506953658;
...
};
Unparsable (to me) Console.app
:
# ui filter: "process:mas"
default 11:37:04.746299-0800 mas [0x600002e40000] activating connection: mach=true listener=false peer=false name=com.apple.cfprefsd.daemon
default 11:37:04.750025-0800 mas networkd_settings_read_from_file initialized networkd settings by reading plist directly
default 11:37:04.750195-0800 mas networkd_settings_read_from_file initialized networkd settings by reading plist directly
default 11:37:04.750848-0800 mas [0x600002e48000] activating connection: mach=true listener=false peer=false name=com.apple.coreservices.launchservicesd
default 11:37:04.751502-0800 mas [0x600002e4c0f0] activating connection: mach=true listener=false peer=false name=com.apple.analyticsd
default 11:37:04.755347-0800 mas Received configuration update from daemon (initial)
default 11:37:04.782527-0800 mas [0x160006aa0] activating connection: mach=true listener=false peer=false name=com.apple.storeassetd
default 11:37:04.782599-0800 mas [0x160006aa0] failed to do a bootstrap look-up: xpc_error=[3: No such process]
default 11:37:04.782613-0800 mas [0x160006aa0] invalidated after a failed init
default 11:37:04.783708-0800 mas CKSoftwareMap: Connection to com.apple.storeassetd was invalidated - removing connection from pool
default 11:37:04.783762-0800 mas CKSoftwareMap: Error from com.apple.storeassetd - Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.storeassetd was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.storeassetd was invalidated: failed at lookup with error 3 - No such process.}
default 11:37:04.783813-0800 mas Entering exit handler.
default 11:37:04.783826-0800 mas Queueing exit procedure onto XPC queue. Any further messages sent will be discarded. activeSendTransactions=0
default 11:37:04.783864-0800 mas Cancelling XPC connection. Any further reply handler invocations will not retry messages
default 11:37:04.783871-0800 mas [0x600002e4c0f0] invalidated because the current process cancelled the connection by calling xpc_connection_cancel()
default 11:37:04.783900-0800 mas XPC connection invalidated (daemon unloaded/disabled)
default 11:37:04.783894-0800 mas Exiting exit handler.
default 11:37:04.800992-0800 mas [0x600003478000] activating connection: mach=true listener=false peer=false name=com.apple.cfprefsd.daemon
default 11:37:04.805566-0800 mas networkd_settings_read_from_file initialized networkd settings by reading plist directly
default 11:37:04.805838-0800 mas networkd_settings_read_from_file initialized networkd settings by reading plist directly
default 11:37:04.806687-0800 mas [0x600003474000] activating connection: mach=true listener=false peer=false name=com.apple.coreservices.launchservicesd
default 11:37:04.807488-0800 mas [0x6000034781e0] activating connection: mach=true listener=false peer=false name=com.apple.analyticsd
default 11:37:04.809700-0800 mas Received configuration update from daemon (initial)
default 11:37:04.836942-0800 mas [0x12ab052b0] activating connection: mach=true listener=false peer=false name=com.apple.storeassetd
default 11:37:04.837066-0800 mas [0x12ab052b0] failed to do a bootstrap look-up: xpc_error=[3: No such process]
default 11:37:04.837080-0800 mas [0x12ab052b0] invalidated after a failed init
default 11:37:04.838068-0800 mas CKSoftwareMap: Connection to com.apple.storeassetd was invalidated - removing connection from pool
default 11:37:04.838130-0800 mas CKSoftwareMap: Error from com.apple.storeassetd - Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.storeassetd was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.storeassetd was invalidated: failed at lookup with error 3 - No such process.}
default 11:37:04.838485-0800 mas [0x12a905a80] activating connection: mach=false listener=false peer=false name=com.apple.CommerceKit.TransactionService
default 11:37:06.271552-0800 mas [0x12ab05cd0] activating connection: mach=true listener=false peer=false name=com.apple.storedownloadd
default 11:37:06.271686-0800 mas [0x12ab05cd0] failed to do a bootstrap look-up: xpc_error=[3: No such process]
default 11:37:06.271702-0800 mas [0x12ab05cd0] invalidated after a failed init
default 11:37:06.271759-0800 mas CKDownloadQueue: Connection to com.apple.storedownloadd was invalidated - removing connection from pool
default 11:37:06.271853-0800 mas CKDownloadQueue: Error from com.apple.storedownloadd - Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.storedownloadd was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.storedownloadd was invalidated: failed at lookup with error 3 - No such process.}