0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Mac】Nixの「cannot connect to socket」を解決する

0
Last updated at Posted at 2026-04-15

Nixは再現性のあるパッケージ管理システム。macOSを宣言的に管理するnix-darwinではLix(Nixのコミュニティ主導フォーク)が推奨されており、筆者もLixを利用している。

Nixを使っていると頻繁に遭遇するエラーがあり、同じく困っている方の参考になればと思い投稿した。

エラー内容

error: cannot connect to socket at '/nix/var/nix/daemon-socket/socket': Connection refused

nix-envnix build など、Nixコマンド実行時に発生する。

原因

nix-daemonが起動していない。

  • macOS再起動後
  • スリープ復帰後
  • macOSアップデート後

解決策

# デーモンをロード
sudo launchctl load /nix/var/nix/profiles/default/Library/LaunchDaemons/org.nixos.nix-daemon.plist

# デーモンを再起動
sudo launchctl kickstart -k system/org.nixos.nix-daemon

確認

nix --version

バージョンが表示されれば解決。

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?