Created
October 27, 2023 19:05
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/[email protected]/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