Search code examples
bashshellzshbun

bun.js not working until running of subsequent scripts


after installing the bun framework I'm prompted to run the following two commands.

Manually add the directory to your $HOME/.zshrc (or similar)

   export BUN_INSTALL="/Users/foo/.bun"
   export PATH="$BUN_INSTALL/bin:$PATH"

after I run these in my terminal bun is working. If I am to close my terminal, reopen and run bun --help I see zsh: command not found: bun

until I run the two following commands from above again. How can I resolve this to not have to repeat those commands?


Solution

  • If you running those export statements from your current shell / cli than those are available only in the current shell environment. It's not available in any other shell you launch.

    You need to put them in your ~/.zshrc so they are exported in every shell environment you launch. Or you can just put them in your ~/.profile ( or ~/.zprofile , whichever you are using) and do source ~/.[z]profile and it would be available in every subsequent shell you launch.