咋回事?
昨天我愉快地将 macOS 升级到了 15 版本,结果今天用 hugo
建站时,发现 hugo
不见了?!
(base) BdimMacBook-Pro:~ bdim404$ hugo
-bash: hugo: command not found
我想,我并没有卸载 hugo
啊。
我的 hugo
是通过 nixpkgs
安装的,于是我检查了一下 nix
是否还在。
(base) BdimMacBook-Pro:~ bdim404$ nix
-bash: nix: command not found
天哪, nix
也不见了?!
发生了什么?
我询问了一位朋友,原来每次 macOS 升级时, nix
的 $PATH
都会消失。这个 issue 提到了这一点。
I have done a few days before the upgrade to Catalina 10.15.6… and today I wanted to install something to discover that my nix installation was gone!
就这样,它消失了!
如何解决?
但我不想重新安装 nix
。
要解决这个问题,请将以下内容添加到你的 /etc/bashrc
或 /etc/zshrc
文件中。
# Nix
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
source '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
# End Nix
就这样。