devbox icon indicating copy to clipboard operation
devbox copied to clipboard

Error when activating devbox global from Fish

Open PascalLeMerrer opened this issue 11 months ago • 10 comments

What happened?

I would like to use devbox as my primary package manager. I'm using Fish as a shell. I added this line

devbox global shellenv --init-hook | source

to .config/fish/config.fish

It results in an error:

- (line 43): Missing end to balance this if statement
if ! type refresh-global >/dev/null 2>&1; then
^^
from sourcing file -
source: Error while reading file '<stdin>'

Steps to reproduce

  1. Add this line

devbox global shellenv --init-hook | source

to .config/fish/config.fish 2. Open a new tab

Running directly devbox global shellenv --init-hook | source in a Fish tab has the same effect.

Command

No response

devbox.json

{
  "$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.10.5/.schema/devbox.schema.json",
  "packages": [
    "helix@latest",
    "git@latest",
    "ripgrep@latest",
    "bat@latest",
    "fzf@latest",
    "jq@latest",
    "eza@latest",
    "atuin@latest",
    "zoxide@latest",
    "broot@latest",
    "lsd@latest",
    "fd@latest",
    "yazi@latest",
    "taskwarrior3@latest",
    "process-compose@latest",
    "superfile@latest",
    "lazygit@latest",
    "fish@latest"
  ],
  "shell": {
    "init_hook": [
      "echo 'Welcome to devbox!' > /dev/null"
    ],
    "scripts": {
      "test": [
        "echo \"Error: no test specified\" && exit 1"
      ]
    }
  }
}

Devbox version

0.13.7

Nix version

nix (Nix) 2.24.9

What system does this bug occur on?

macOS (Apple Silicon)

Debug logs

Last login: Wed Jan 15 06:56:24 on ttys006 time=2025-01-15T06:57:46.644+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:125 msg="searching for config file (including parent directories)" path=. time=2025-01-15T06:57:46.645+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:146 msg="trying config file" path=devbox.json time=2025-01-15T06:57:46.646+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:133 msg="config file found" path=/Users/pascal/Documents/menus/devbox.json dur=1.534167ms time=2025-01-15T06:57:46.646+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:125 msg="searching for config file (including parent directories)" path=. time=2025-01-15T06:57:46.646+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:146 msg="trying config file" path=devbox.json time=2025-01-15T06:57:46.646+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:133 msg="config file found" path=/Users/pascal/Documents/menus/devbox.json dur=46.042µs time=2025-01-15T06:57:46.702+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/nix/nix.go:342 msg="nix --version --debug output" out="nix (Nix) 2.24.9\nSystem type: aarch64-darwin\nAdditional system types: x86_64-darwin\nFeatures: gc, signed-caches\nSystem configuration file: /etc/nix/nix.conf\nUser configuration files: /Users/pascal/.config/nix/nix.conf:/etc/xdg/nix/nix.conf\nStore directory: /nix/store\nState directory: /nix/var/nix\nData directory: /nix/store/1n95r340s7p3vdwqh7m94q0a42crahqq-nix-2.24.9/share\n" time=2025-01-15T06:57:46.703+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/nix/command.go:60 msg="nix command starting" cmd.args="nix --extra-experimental-features ca-derivations --option experimental-features 'nix-command flakes fetch-closure' eval --impure --raw --expr builtins.currentSystem" cmd.path=/nix/var/nix/profiles/default/bin/nix time=2025-01-15T06:57:46.733+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/nix/command.go:67 msg="nix command exited" cmd.args="nix --extra-experimental-features ca-derivations --option experimental-features 'nix-command flakes fetch-closure' eval --impure --raw --expr builtins.currentSystem" cmd.path=/nix/var/nix/profiles/default/bin/nix cmd.pid=38490 cmd.code=0 cmd.dur=30.655375ms time=2025-01-15T06:57:46.734+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:90 msg="searching for config file (excluding parent directories)" path=/Users/pascal/.local/share/devbox/global/default time=2025-01-15T06:57:46.734+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:146 msg="trying config file" path=/Users/pascal/.local/share/devbox/global/default/devbox.json time=2025-01-15T06:57:46.734+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:95 msg="config file found" path=/Users/pascal/.local/share/devbox/global/default/devbox.json dur=571.833µs time=2025-01-15T06:57:46.735+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=helix mode=auto time=2025-01-15T06:57:46.735+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=git mode=auto time=2025-01-15T06:57:46.735+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=ripgrep mode=auto time=2025-01-15T06:57:46.735+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=bat mode=auto time=2025-01-15T06:57:46.735+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=fzf mode=auto time=2025-01-15T06:57:46.735+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=jq mode=auto time=2025-01-15T06:57:46.735+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=eza mode=auto time=2025-01-15T06:57:46.735+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=atuin mode=auto time=2025-01-15T06:57:46.735+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=zoxide mode=auto time=2025-01-15T06:57:46.735+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=broot mode=auto time=2025-01-15T06:57:46.735+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=lsd mode=auto time=2025-01-15T06:57:46.735+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=fd mode=auto time=2025-01-15T06:57:46.735+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=yazi mode=auto time=2025-01-15T06:57:46.735+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=taskwarrior3 mode=auto time=2025-01-15T06:57:46.735+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=process-compose mode=auto time=2025-01-15T06:57:46.735+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=superfile mode=auto time=2025-01-15T06:57:46.735+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=lazygit mode=auto time=2025-01-15T06:57:46.735+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=fish mode=auto time=2025-01-15T06:57:46.735+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=helix mode=auto time=2025-01-15T06:57:46.735+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=git mode=auto time=2025-01-15T06:57:46.735+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=ripgrep mode=auto time=2025-01-15T06:57:46.735+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=bat mode=auto time=2025-01-15T06:57:46.735+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=fzf mode=auto time=2025-01-15T06:57:46.735+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=jq mode=auto time=2025-01-15T06:57:46.735+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=eza mode=auto time=2025-01-15T06:57:46.735+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=atuin mode=auto time=2025-01-15T06:57:46.735+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=zoxide mode=auto time=2025-01-15T06:57:46.736+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=broot mode=auto time=2025-01-15T06:57:46.736+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=lsd mode=auto time=2025-01-15T06:57:46.736+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=fd mode=auto time=2025-01-15T06:57:46.736+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=yazi mode=auto time=2025-01-15T06:57:46.736+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=taskwarrior3 mode=auto time=2025-01-15T06:57:46.736+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=process-compose mode=auto time=2025-01-15T06:57:46.736+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=superfile mode=auto time=2025-01-15T06:57:46.736+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=lazygit mode=auto time=2025-01-15T06:57:46.736+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=fish mode=auto time=2025-01-15T06:57:46.736+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=helix mode=auto time=2025-01-15T06:57:46.736+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=git mode=auto time=2025-01-15T06:57:46.736+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=ripgrep mode=auto time=2025-01-15T06:57:46.736+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=bat mode=auto time=2025-01-15T06:57:46.736+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=fzf mode=auto time=2025-01-15T06:57:46.736+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=jq mode=auto time=2025-01-15T06:57:46.736+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=eza mode=auto time=2025-01-15T06:57:46.736+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=atuin mode=auto time=2025-01-15T06:57:46.736+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=zoxide mode=auto time=2025-01-15T06:57:46.736+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=broot mode=auto time=2025-01-15T06:57:46.736+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=lsd mode=auto time=2025-01-15T06:57:46.736+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=fd mode=auto time=2025-01-15T06:57:46.736+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=yazi mode=auto time=2025-01-15T06:57:46.736+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=taskwarrior3 mode=auto time=2025-01-15T06:57:46.736+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=process-compose mode=auto time=2025-01-15T06:57:46.736+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=superfile mode=auto time=2025-01-15T06:57:46.736+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=lazygit mode=auto time=2025-01-15T06:57:46.736+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=fish mode=auto time=2025-01-15T06:57:46.737+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devbox/devbox.go:691 msg="current environment PATH" path=/Users/pascal/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Applications/Ghostty.app/Contents/MacOS time=2025-01-15T06:57:46.737+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devbox/devbox.go:706 msg="nix environment PATH" path=/Users/pascal/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Applications/Ghostty.app/Contents/MacOS time=2025-01-15T06:57:46.737+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devbox/devbox.go:740 msg="PATH after plugins and config" path=/Users/pascal/.local/share/devbox/global/default/.devbox/nix/profile/default/bin:/Users/pascal/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Applications/Ghostty.app/Contents/MacOS time=2025-01-15T06:57:46.737+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devbox/devbox.go:764 msg="PATH after filtering buildInputs" inputs=[] path=/Users/pascal/.local/share/devbox/global/default/.devbox/nix/profile/default/bin:/Users/pascal/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Applications/Ghostty.app/Contents/MacOS time=2025-01-15T06:57:46.738+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=helix mode=auto time=2025-01-15T06:57:46.738+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=git mode=auto time=2025-01-15T06:57:46.738+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=ripgrep mode=auto time=2025-01-15T06:57:46.738+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=bat mode=auto time=2025-01-15T06:57:46.738+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=fzf mode=auto time=2025-01-15T06:57:46.738+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=jq mode=auto time=2025-01-15T06:57:46.738+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=eza mode=auto time=2025-01-15T06:57:46.738+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=atuin mode=auto time=2025-01-15T06:57:46.738+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=zoxide mode=auto time=2025-01-15T06:57:46.738+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=broot mode=auto time=2025-01-15T06:57:46.738+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=lsd mode=auto time=2025-01-15T06:57:46.738+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=fd mode=auto time=2025-01-15T06:57:46.738+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=yazi mode=auto time=2025-01-15T06:57:46.738+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=taskwarrior3 mode=auto time=2025-01-15T06:57:46.738+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=process-compose mode=auto time=2025-01-15T06:57:46.738+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=superfile mode=auto time=2025-01-15T06:57:46.738+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=lazygit mode=auto time=2025-01-15T06:57:46.738+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:200 msg="package doesn't need patching" pkg=fish mode=auto time=2025-01-15T06:57:46.738+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devbox/devbox.go:783 msg="new path stack is" path_stack=DEVBOX_NIX_ENV_PATH_7841c13e830095fdd42d5bd06a3d3645cde0448446cbc57c1773079146dd1b05:DEVBOX_INIT_PATH time=2025-01-15T06:57:46.738+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devbox/devbox.go:785 msg="computed environment PATH" path=/Users/pascal/.local/share/devbox/global/default/.devbox/nix/profile/default/bin:/Users/pascal/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Applications/Ghostty.app/Contents/MacOS:/Users/pascal/.local/share/devbox/global/default/.devbox/virtenv/runx/bin time=2025-01-15T06:57:46.738+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:125 msg="searching for config file (including parent directories)" path=. time=2025-01-15T06:57:46.738+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:146 msg="trying config file" path=devbox.json time=2025-01-15T06:57:46.738+01:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:133 msg="config file found" path=/Users/pascal/Documents/menus/devbox.json dur=74.583µs

  • (line 40): Missing end to balance this if statement if ! type refresh-global >/dev/null 2>&1; then ^^ from sourcing file - called on line 4 of file ~/.config/fish/config.fish from sourcing file ~/.config/fish/config.fish called during startup source: Error while reading file '' Welcome to fish, the friendly interactive shell Type help for instructions on how to use fish

PascalLeMerrer avatar Jan 15 '25 06:01 PascalLeMerrer

I installed Fish using devbox and I'm trying to start devbox from Fish. Is that possible?

PascalLeMerrer avatar Jan 15 '25 07:01 PascalLeMerrer

This does not solve the problem on my computer

❯ fish
- (line 46): Missing end to balance this if statement
if ! type refresh-global >/dev/null 2>&1; then
^^
from sourcing file -
        called on line 5 of file ~/.config/fish/config.fish
from sourcing file ~/.config/fish/config.fish
        called during startup

PascalLeMerrer avatar Feb 09 '25 07:02 PascalLeMerrer

My guess is that there is some kind of auto discovery for the init shell script and it fails to discover that your shell is a fish shell and therefore outputs the init hook for bash.

You could maybe somehow force that Devbox will discover the shell as fish.

weitzj avatar Feb 09 '25 19:02 weitzj

My guess is that there is some kind of auto discovery for the init shell script and it fails to discover that your shell is a fish shell and therefore outputs the init hook for bash.

You could maybe somehow force that Devbox will discover the shell as fish.

Thanks for this @weitzj. Your comment led me to resolve the issue by using Wezterm's set_environment_variables like so:

config.set_environment_variables = {
    SHELL = "/Users/<username>/.local/share/devbox/global/default/.devbox/nix/profile/default/bin/fish"
}

By the way, @PascalLeMerrer I believe I found an answer to your question in working to resolve the global shellenv issue. In my Wezterm config, I've set default_prog to:

config.default_prog = { '/Users/<username>/.local/share/devbox/global/default/.devbox/nix/profile/default/bin/fish', '-l' }

I hope this helps!

jrdelarosa8 avatar Feb 13 '25 05:02 jrdelarosa8

For my case I had to change my shell by adding Fish Shell as a valid Shell on MacOS in /etc/Shells and then using „chsh“ with my username

Also I use ghostty on OSX

weitzj avatar Feb 13 '25 07:02 weitzj

For my case I had to change my shell by adding Fish Shell as a valid Shell on MacOS in /etc/Shells and then using „chsh“ with my username

Also I use ghostty on OSX

I considered making these same changes but noticed that changing the login shell can cause issues per the Fish documentation.

jrdelarosa8 avatar Feb 13 '25 14:02 jrdelarosa8

I had the same issue with devbox 0.14.2 on macos 15.4.1

/etc/shells

# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.

/bin/bash
/bin/csh
/bin/dash
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
/opt/homebrew/bin/fish
❯ fish
- (line 170): Missing end to balance this if statement
if ! type refresh-global >/dev/null 2>&1; then
^^
from sourcing file -
        called on line 135 of file ~/.config/fish/config.fish
from sourcing file ~/.config/fish/config.fish
        called during startup
source: Error while reading file '<stdin>'

ebauger avatar May 15 '25 15:05 ebauger

Even if you add the Shell as a valid Shell, it has to be Started fairly early. So probably what happens on your machine is that you start a zsh, which starts a fish shell and therefore the auto discovery of devbox will think it is zsh

weitzj avatar May 20 '25 16:05 weitzj

Uses basename $SHELL or similiar. As mentioned in https://github.com/jetify-com/devbox/issues/2480#issuecomment-2656819073, using fish as the user shell is discouraged.

Update:

I remove the command=fish from ghostty and added the following to $HOME/.bashrc, from the Arch Linux Wiki:

if [[ $(ps --no-header --pid=$PPID --format=comm) != "fish" && -z ${BASH_EXECUTION_STRING} && ${SHLVL} == 1 ]]
then
	shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION=''
	exec fish $LOGIN_OPTION
fi

My config.fish contains:

set -gx SHELL fish
devbox global shellenv --init-hook | source

This, so far, is working including refresh-global

mattwillsher avatar May 25 '25 18:05 mattwillsher

My config.fish contains:

set -gx SHELL fish devbox global shellenv --init-hook | source

Adding these two lines to my config.fish file seemed to help Devbox global work for me as well. Thanks!

noahsettersten avatar Jul 08 '25 14:07 noahsettersten