Run zsh alias via automator? I am using zsh with oh-my-zsh in iTerm on macOS. There are some aliases defined in my .zshrc I use often, like this:

deploy(){
 cd ~/Path/To/My/Project;
 build ...;
 rsync ...;
}


To execute this, I have to switch over to iTerm and run the alias.
Now I'd like to be able to do that from anywhere via a hotkey.

I've read that automator is the tool of choice.

I created an action "run shell script" and chose `/bin/zsh/' from the list of available shells.

But running my alias returns zsh:1: command not found.

Am I on the wrong shell? But echo $0 in iTerm gives me -zsh.

How can I run my alias without being in the iTerm window? Any approach will do, Automator is just how I'm trying to accomplish it.
The solution is to source the file dependencies you need inside the automator script.

Example if you added all of your scripts to ~/.zshrc

source ~/.zshrc
deploy


You can debug things easier by doing which deploy to check to see if that script is accessible.