#1983·hatch

Mac (1.14.1): issue with the .pkg installed "standalone" version of hatch in a shell

Author: crastCreated May 27, 2025Updated Jul 22, 2026

When hatch is installed from the .pkg e.g. from https://hatch.pypa.io/latest/install/#macos there is an issue that a shell script is created in ~/Library/Application Support/pyapp/hatch/7026724171314236266/1.14.1/python/bin/hatch that is broken. This doesn't come up when inside a "normal" shell as the /usr/local/hatch/bin/hatch stand-alone executable works fine, but it does happen "inside" a hatch shell.

(note: The following shell outputs were mildly censored to remove my home directory which contains my full name, and the project name, but otherwise unmodified)

bash
$ hatch shell
source "/Users/crast/Library/Application Support/hatch/env/virtual/some-project/qvFvOaBn/some-project/bin/activate"

(some-project) $ hatch run command
/Users/crast/Library/Application Support/pyapp/hatch/7026724171314236266/1.14.1/python/bin/hatch: line 2: /Users/crast/Library
Support/pyapp/hatch/7026724171314236266/1.14.1/python/bin/python3.12: No such file or directory
/Users/crast/Library/Application Support/pyapp/hatch/7026724171314236266/1.14.1/python/bin/hatch: line 2: exec: /Users/crast/Library
Support/pyapp/hatch/7026724171314236266/1.14.1/python/bin/python3.12: cannot execute: No such file or directory

note the folder "thinks" the python is "Library Support" and not "Library/Application Support", I think this must be a bit of weirdness with the space in the folder name

A simple "workaround" is just

bash
rm ~/Library/Application\ Support/pyapp/hatch/7026724171314236266/1.14.1/python/bin/hatch

This works because then the shell will go back to using the /usr/local version of hatch, the standalone binary. This should continue to work until I update hatch, I believe.

In either case, I have tested with hatch installed other ways, like either with the system python and pip install or with brew install hatch which installs also 1.14.1 and both don't have this issue since neither have a second hatch entrypoint (and also those entrypoints are a small python wrapper, not a shell script wrapper)

Perhaps this is more illustrative:

standalone .pkg hatch

bash
$ /usr/local/hatch/bin/hatch shell
(some-project) $ which hatch
/Users/crast/Library/Application Support/pyapp/hatch/7026724171314236266/1.14.1/python/bin/hatch
(some-project) $ cat "$(which hatch)"
#!/bin/sh
"exec" "$(dirname $0)/python3.12" "$0" "$@"
# -*- coding: utf-8 -*-
import re
import sys
from hatch.cli import main
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(main())

homebrew hatch

bash
$ /opt/homebrew/bin/hatch shell
(some-project) $ which hatch
/opt/homebrew/bin/hatch
(some-project) $ cat "$(which hatch)"
#!/opt/homebrew/Cellar/hatch/1.14.1_1/libexec/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from hatch.cli import main
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(main())