When using AeroSpace (a tiling window manager for macOS), GUI applications don’t have Homebrew’s prefix in their PATH by default. This means Homebrew binaries like sketchybar or yabai won’t be found unless you specify the full path.

AeroSpace handles this automatically with a sensible default configuration. If you don’t override the [exec] section, it uses:

1
2
3
4
[exec]
    inherit-env-vars = true
[exec.env-vars]
    PATH = '/opt/homebrew/bin:/opt/homebrew/sbin:${PATH}'

If you need custom environment variables, preserve the Homebrew PATH when overriding the [exec] section:

1
2
3
4
5
6
[exec]
    inherit-env-vars = true
[exec.env-vars]
    PATH = '/opt/homebrew/bin:/opt/homebrew/sbin:${PATH}'
    # Add your custom environment variables here
    MY_CUSTOM_VAR = 'value'

On Intel Macs, Homebrew installs to /usr/local instead:

1
2
[exec.env-vars]
    PATH = '/usr/local/bin:/usr/local/sbin:${PATH}'

With the PATH configured, you can run Homebrew commands directly:

1
2
3
4
5
6
7
# Works because Homebrew is in PATH
exec-on-workspace-change = '''
  sketchybar --trigger aerospace_workspace_change
'''

# Or execute custom scripts
on-focused-monitor-changed = ['my-custom-script.sh']

Resources: