Run a Zsh Script

Updated on

Create a new file. Let's call it myscript. You don't need an extension, but you do need to put #!/bin/zsh at the top of the file to tell your system that this is a zsh script.

The file must be in your bin or in your $PATH. On a Mac, the path to your bin usually looks like /usr/local/bin. If you want to keep your custom scripts in a separate folder, you have to add that folder to your $PATH.

Make it executable. Run chmod +x myscript.

Run myscript.