giewont39
giewont39

Reputation: 1

default to zsh interpreter in Mac Terminal?

How can I make sure .sh files are executed with the zshell interpreter from the Mac terminal without specifying the zsh prefix every time? The shell default is set to zshell already but a command to run a .sh file won't execute unless I prefix with zsh...

Upvotes: 0

Views: 934

Answers (1)

Victor Valente
Victor Valente

Reputation: 801

To change the shell to zsh: chsh -s $(which zsh) (zsh is probably the default shell already).

To run a .sh script without having to use zsh command:

  1. prefix the script with a shebang line such as #!/usr/bin/env zsh.
  2. make the script executable: chmod +x <filename>
  3. run it as ./<filename>

Upvotes: 1

Related Questions