Setting Up Python Development Environment on Apple Silicon (M1~M3) MacBook

힘센캥거루
2026년 1월 13일(수정됨)
2
12

I tried to install Python using Homebrew on my MacBook, but when entering python3 in the terminal, the default Python 3.9 version kept being called.

I’m leaving a guide for Python environment setup in case I need to reset my MacBook later.

1. Installing Homebrew

First, let's install Homebrew.

If Linux has apt-get, then MacBook has brew. 

Setting Up Python Development Environment on Apple Silicon (M1~M3) MacBook-1

Enter the following command in the terminal to install homebrew.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

You might still see a message saying there is no command when you enter brew in the terminal.

You need to set the environment variables for the brew command.

Enter the following command in the terminal, then

open ~/.zshrc

Enter the content below and press cmd+s repeatedly. 

export PATH=/opt/homebrew/bin:$PATH

Then, by applying the changes with the source command, you can install Python with the homebrew command.

source ~/.zshrc

2. Installing Python

Use brew to install Python.

If you want a specific Python version, you can append @ and enter the version number after python. 

brew install python

brew install python@3.11

Next, check the installation location of Python using the which command.

which python3.11

Usually, the path for Python on Apple Silicon MacBook is /opt/homebrew/bin/python.

Setting Up Python Development Environment on Apple Silicon (M1~M3) MacBook-2

Now it's time to set the Python path. Open the ./zshrc file using the open command like before.

open ~/.zshrc

Enter the command below and press cmd+s repeatedly.

alias python="/opt/homebrew/bin/python3.11"

By applying the changes with the source command, you can confirm that the Python version has changed to the one installed via homebrew.

source ~/.zshrc
python --version
Setting Up Python Development Environment on Apple Silicon (M1~M3) MacBook-3

3. Installing pip

After doing this, you may see warnings when trying to install something with pip.

The pip registered in the system points to the Python that comes pre-installed on the Mac.

To avoid complications, I just installed pip on Python. Try the command below in the terminal.

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py

This is all it takes to install pip.

Check the version of pip and the Python location where pip is installed with the following command.

pip -V
Setting Up Python Development Environment on Apple Silicon (M1~M3) MacBook-4

This completes the global environment setup.

Happy coding!

관련 글

Automating School Work – Using AI to Check Subject-Specific Remarks in Student Records
Automating School Work – Using AI to Check Subject-Specific Remarks in Student Records
If I had to pick the most meaningless, exhausting, and boring task at school, I would choose checking student records.In middle school, the student re...
Book Review and Challenge Review of Chapter 7 of *Building an LLM from Scratch*
Book Review and Challenge Review of Chapter 7 of *Building an LLM from Scratch*
Chapter 7 covers the process of fine-tuning a model to follow instructions.In other words, making it give the desired response to a given question.As...
Review of Chapter 6 of *Build an LLM from Scratch*
Review of Chapter 6 of *Build an LLM from Scratch*
Chapter 6 is about fine-tuning for classification.The example used is building a spam classifier.A spam classifier determines whether something is spa...
Review of Chapter 5 of *Building an LLM from Scratch*
Review of Chapter 5 of *Building an LLM from Scratch*
Today is December 14.The challenge period actually ended two weeks ago, but I couldn’t just give up on writing a review.Because these TILs I leave lik...
Impressions After Reading Chapter 4 of “LLM From Scratch”
Impressions After Reading Chapter 4 of “LLM From Scratch”
Today is November 26, so if I finish one chapter a day, I’ll complete the challenge.I’m not sure if I can do it with my first and second kids constant...
Review of Chapter 3 of Learning LLM from Scratch
Review of Chapter 3 of Learning LLM from Scratch
After spilling a bucket of water on my MacBook, I was in shock and wasted about 3-4 days. In retrospect, since my MacBook was already damaged, I should have thought of it as being sent for repair and done something. Anyway, although it's a bit late, I am determined to see it through and leave a review of Chapter 3. 1. Attention Mechanism Chapter 3...

댓글을 불러오는 중...