Skip to main content
13 votes
Accepted

A recommended way to use a command-line utility that isn't added to PATH

One obvious solution is to add the directory containing the program to your PATH setting. This is commonly practiced on Windows, but not on Unix. There are several reasons why this isn't a good idea: ...
Gilles 'SO- stop being evil''s user avatar
10 votes
Accepted

Can .zshrc be modified automatically by other programs, installers, etc.?

It certainly is possible: any program you run has the permission to modify your .zshrc. But in practice, of course, most programs won't do it. Installers and configurations directly related to zsh are ...
Gilles 'SO- stop being evil''s user avatar
9 votes

'exec fish' at the very bottom of my '.zshrc' - is it possible to bypass it?

This solution sounds to me like it introduces more problems than it solves :) You can simply set the default shell that the macOS Terminal uses in its configuration. No need to set the login shell to ...
Marcus Müller's user avatar
6 votes
Accepted

'exec fish' at the very bottom of my '.zshrc' - is it possible to bypass it?

But then, what if I nevertheless want to switch from fish to zsh for some specific reason? Is it possible somehow? You can check a variable: [ "$SKIP_FISH" != yes ] && exec fish ...
faho's user avatar
  • 1,471
6 votes

Can .zshrc be modified automatically by other programs, installers, etc.?

By default, there is nothing preventing applications from modifying your account config files. If this is really a big issue, I suggest copying your config files to a directory, checking everything ...
user10489's user avatar
  • 8,283
3 votes

A recommended way to use a command-line utility that isn't added to PATH

I've never had a Mac, but I do this with an alias constantly. If .zshrc is the Mac equivalent of .bashrc, then just add: if [ -f ~/.zsh_aliases ]; then . ~/.zsh_aliases fi Then run: touch ~/....
JayCravens's user avatar
2 votes

turning list of file paths from one command into command-line arguments for another

Quoting is part of the syntax of the shell language. You only need quotes if you're writing shell code. The default xargs input format also understands its own form of quoting, one that is different ...
Stéphane Chazelas's user avatar
2 votes

turning list of file paths from one command into command-line arguments for another

If you have an array and just want to pass the elements intact to a command, it's enough to use $array in zsh, or "${array[@]}" (with quotes!) in Bash/ksh. The former drops empty elements, ...
ilkkachu's user avatar
  • 144k
2 votes
Accepted

zsh, macOS: Which file should be used to modify the $PATH variable, and how exactly?

TLDR: I suggest to use ~/.zshenv and to check the other files that your change does not get overwritten. Citing https://zsh.sourceforge.io/Guide/zshguide02.html, section 2.2: All the startup files: ...
Bodo's user avatar
  • 6,403
1 vote
Accepted

zsh, .bash_profile, and aliases

.bash_profile is only used when initialising login shells. If you want its contents to be interpreted, you need to add -l to your bash invocations. Alias definitions typically go in .bashrc which is ...
Stephen Kitt's user avatar
1 vote

Can .zshrc be modified automatically by other programs, installers, etc.?

To complete the other answers, I can give you at least one concrete example: the installation of Anaconda will modify your shell config if you use the default setup. In this answer you can see a code ...
EPrivat's user avatar
  • 11

Only top scored, non community-wiki answers of a minimum length are eligible