-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Can't find nix-shell after installationon mac OS X #2280
Comments
I'm struggling with this issue too. As far as I'm aware, when a login shell starts, it loads certain init scripts like
|
Same boat, but I'm using bash as my shell. It seems to never actually modify |
Same problem here, and I'm running bash. I figured out after a while that the You can hack-fix it by symlinking to Seems kinda related to #2295 |
Is this currently still broken? Are there any good workarounds? |
Dunno. After zero support here and anti-support in IRC I gave up. Just not worth the apathy and hostility to deal with it. |
There seems to be a case where the installer script modifies
However I am using zsh, which does not load The installer script seems to assume you are using bash. The culprit appears to be this line, which doesn't look for any other shells than bash (and only specific bash files that aren't guaranteed to be there) or shells that source nix/scripts/install-nix-from-closure.sh Line 144 in 5112a33
Below is the problem line in context for the macOS installer.
@zenspider Hopefully this helps. |
I've had the same problem on a fresh Ubuntu 19.10 and the problem was gone as soon as I've rebooted. |
Yep, similar thing here. On my system the Instead, I had to log out and back in, which loaded the appropriate PATH from |
I marked this as stale due to inactivity. → More info |
Should be fixable by adjusting the PATH after finishing installation |
https://stackoverflow.com/a/54087505/6341943 |
This is what got it to work for me. I think that the installer script just assumes you use bash and doesn't account for the files loaded by zsh. |
zsh is standard on mac OS now |
I had this issue after upgrading my macOS version. Personally, I am using home-manager with flake (not 100% sure what it means). To solve my issue, I needed to add the below snippet at the bottom of # Nix
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
# End Nix |
You must use |
Same issue on macOS 12.5.1 with typical zsh shell. $ nix-shell
zsh: command not found: nix-shell I verified the Nix installer appended the file
I verified the Nix installer created the file: $ ls /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh I verified the Nix daemon is running: $ ps aux | grep nix-daemon
root 14409 0.0 0.0 409085616 21568 ?? Ss 1:07PM 0:00.06 /nix/var/nix/profiles/default/bin/nix-daemon What's next please? |
if you have used nix itself to install zsh and ran the install script within zsh you will need to go back to editing the .bashrc and add the nix-daemon.sh line since you will be using bash instead of zsh again |
In case anyone else stumbles upon this after a MacOS upgrade (it hit me upgrading to Monterey 12.6), in the install/uninstall documentation it mentions the file to source, as shown above: https://nixos.org/manual/nix/stable/installation/installing-binary.html#macos
My preference is to override any system-wide setting with my user |
I have the same issue on macOS Ventura 13.2 (22D49) + zsh on a fresh install through I've confirmed that:
I've tried:
Any ideas on what next? editI fixed this by commenting out the lines that short-circuits on # file: /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
# Only execute this file once per shell.
- if [ -n "${__ETC_PROFILE_NIX_SOURCED:-}" ]; then return; fi
- __ETC_PROFILE_NIX_SOURCED=1
+ # if [ -n "${__ETC_PROFILE_NIX_SOURCED:-}" ]; then return; fi
+ # __ETC_PROFILE_NIX_SOURCED=1 Unsure why this happens 🤷🏻♂️ |
Just chiming in to say adding this your
|
Also chiming in to say I fixed it by adding it to my local zshrc and adding this # Nix
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
unset __ETC_PROFILE_NIX_SOURCED
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
# End Nix |
I had the same issue after upgrading to macOS ventura 13.5, and fixed it by adding the following line:
I got this from the docs: https://nixos.org/manual/nix/stable/installation/env-variables#environment-variables |
I would recommend re-running the Nix installer. |
Ran into this as well and the hints from answers above (@2mol @ryanorendorff) did help me move forward. Short version:
now |
same issue for me, @chevdor solution worked for me. I use OSX 13.4.1 and zsh and used |
I upgraded macOS from version 13 to 14, and I confirm that reinstalling restored my Nix environment. Thanks! |
The answer https://stackoverflow.com/a/73799336 from this question solved my problem. |
I had this issue because my ~/.zshrc was unsetting Specifically, I had this stanza:
I have absolutely no idea why, and have no memory of writing this. Maybe it's a default on mac, oh-my-zsh, something else? Either way, if you have |
On Mac OS X (10.11.6) I ran
curl https://nixos.org/nix/install | sh
which downloadedhttps://nixos.org/releases/nix/nix-2.0.4/nix-2.0.4-x86_64-darwin.tar.bz2
On completion this was printed:
I started a new shell but nix-shell is not on my PATH in fish nor in bash
I found
nix-shell
in /nix but could not start it:Should the post-install instructions be updated? Are there any additional steps needed to get nix-shell to run?
The text was updated successfully, but these errors were encountered: