-1

So, I just installed bombardier and when I call it, it was saying "not found"... so I found that if I ran

export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/go;
export PATH=$PATH:$GOPATH/bin;

it would work...

but when I open a new terminal tab, guess what? bombardier is not found again and I have to re-export. what should I do? I read about .zsh, .zshrc and what-not files but couldn't find any of these. I could only find .zprofile and .zsh_history and a .zsh_sessions folder

Leonardo
  • 10,737
  • 10
  • 62
  • 155
  • A new terminal tab creates a new, **unrelated** process. How should the environment magically be transported there? If you had created a zsh subshell, the settings would have been kept. – user1934428 Aug 18 '23 at 06:46
  • Actrually, I would consider `~/.zshenv` for putting the settings there. However, I am not sure that your PATH settings really make sense. You add to your path `/usr/local/go/bin:$HOME/go/bin`. If you have a go-installation in both directories, only the first would be picked up. – user1934428 Aug 18 '23 at 06:48

2 Answers2

0

… when I open a new terminal tab…

Exported variables set in a shell are exported to processes created by that shell. A shell in a new terminal window is created by the Terminal application. It starts a new shell from scratch.

I read about .zsh, .zshrc and what-not files but couldn't find any of these.

You are supposed to make them. Create a new file in your home folder named .zshrc and put the commands into it.

Eric Postpischil
  • 195,579
  • 13
  • 168
  • 312
  • create them and fill them with what? just throw those 3 lines in there? isn't this going to break something else? – Leonardo Aug 17 '23 at 20:14
  • @Leonardo: An interactive `zsh` shell executes commands in `~/.zshrc` when it starts. You want it to execute those commands. So put those commands in it. What else do you think will break? It will be like you executed the commands yourself. Executing various commands can break other things. E.g., if you set `PATH` one way and some other aspect of your configuration expects something different, it can break. – Eric Postpischil Aug 17 '23 at 20:34
  • @Leonardo : If you have your shell execute commands, you are (as a programmer) supposed to know what the commands do. So you can usually decide whether they break something. If you don't understand what a certain command is doing, I agree that it would be better to ask first at i.e. [su], instead of blindly putting it into your shell startup files. – user1934428 Aug 19 '23 at 12:06
0

According to this question .zshrc file is not present in MacOS so you need to manually create them by doing touch ~/.zshrc andn touch ~/.zsh

U.P.D. Also according to this question you need to copy the contents of ~/.bash_profile file into ~/.zshrc file

U.P.D. #2. Instead of ~/.bash_profile you must copy the contents of ~/.zprofile because Apple changed the default shell to zsh since MacOS Catalina

MiTask
  • 26
  • 2
  • Since there is no point in just creating an empty .zshrc, I would not use `touch`. There is a very fine class of programs called _text editors_, which not only create the file on the fly, but also allow you to fill the file with the content of your desire. – user1934428 Aug 19 '23 at 12:07
  • Further I would strongly recommend against blindly copying the content of .bash_profile. This file contains bash commands, while you (logically) need now zsh commands. However, it makes sense to use .bash_profile as a starting point and rewrite it as zsh. Some of the commands may even work the same, because bash and zsh share some similarities. Those commands can of course safely be copied. – user1934428 Aug 19 '23 at 12:09