The default installation instructions for the Homebrew package manager do not run on Nushell. Instead, you can use:
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | bash
The installation script gives commands to configure the path on zsh (and probably other shells), but not Nushell. It took me some time to realize that the Nushell documentation actually has instructions specifically for Homebrew! The following will make brew
work in your current session.
# macOS ARM64 (Apple Silicon)
$env.PATH = ($env.PATH | split row (char esep) | prepend '/opt/homebrew/bin')
# Linux
$env.PATH = ($env.PATH | split row (char esep) | prepend '/home/linuxbrew/.linuxbrew/bin')
But if you want to save the udpated path for future sessions, I think that it is cleaner to do the following. First, open your config editor with config env
. Then, scroll down to the comment that says something along these lines:
# To add entries to PATH (on Windows you might use Path), you can use the following pattern:
# $env.PATH = ($env.PATH | split row (char esep) | prepend '/some/path')
# An alternate way to add entries to $env.PATH is to use the custom command `path add`
# which is built into the nushell stdlib:
# use std "path add"
# $env.PATH = ($env.PATH | split row (char esep))
# path add /some/path
Now, you can simply follow the example and add the following two lines to your env.nu
file:
use std "path add"
path add "/home/linuxbrew/.linuxbrew/bin"
Of course, you can skip the use std "path add"
line if you already imported the stdlib earlier, and replace the path with the Apple Silicon path if necessary.