Created
February 28, 2019 19:00
-
-
Save kalbasit/45efe8d3464736c2f3980a260e824b4e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ! nix-shell -p hello --run 'hello' &>/dev/null; then | |
# The following condition addresses https://github.com/NixOS/nix/issues/2523 | |
if [[ "$(uname -s)" == "Darwin" ]] && [[ "$( grep -E 'nix-daemon.*fork()' /var/log/system.log | wc -l )" -gt 0 ]]; then | |
>&2 echo ">>> I ran into a Mac-specific bug (https://github.com/NixOS/nix/issues/2523) and I'm applying the workaround automatically for it." | |
sudo launchctl remove org.nixos.nix-daemon | |
sed \ | |
-e "s:<key>Program</key>:<key>EnvironmentVariables</key><dict><key>OBJC_DISABLE_INITIALIZE_FORK_SAFETY</key><string>YES</string></dict>&:g" \ | |
/Library/LaunchDaemons/org.nixos.nix-daemon.plist > /tmp/org.nixos.nix-daemon.plist | |
sudo mv /tmp/org.nixos.nix-daemon.plist /Library/LaunchDaemons/org.nixos.nix-daemon.plist | |
sudo chown root: /Library/LaunchDaemons/org.nixos.nix-daemon.plist | |
sudo launchctl load /Library/LaunchDaemons/org.nixos.nix-daemon.plist | |
nix-shell -p hello --run 'hello' | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment