Skip to content

Instantly share code, notes, and snippets.

@tommyjtl
Created October 27, 2023 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tommyjtl/696649ff61670c6d777b4a7dcfd72d39 to your computer and use it in GitHub Desktop.
Save tommyjtl/696649ff61670c6d777b4a7dcfd72d39 to your computer and use it in GitHub Desktop.
Bash function to quickly launch the arm64 version of Python on macOS with Apple Silicon.
python-arm() {
# Get the platform information
platform=$(uname -m)
# Check if the platform is darwin arm
if [[ "$platform" == "arm64" ]]; then
# Run the desired command if on darwin arm platform
/opt/homebrew/opt/python@3.9/bin/python3.9 "$@"
else
# Exit if not on darwin arm platform
echo "Not running on darwin arm platform."
return 1
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment