Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jqn/e4b1e8a5a92f98c7985a6b0231950ac9 to your computer and use it in GitHub Desktop.
Save jqn/e4b1e8a5a92f98c7985a6b0231950ac9 to your computer and use it in GitHub Desktop.
-- Disable SIP (csrutil disable)
ref: https://github.com/pypa/virtualenv/issues/2023
-- Run SHELL as x86_64 mode
arch -x86_64 $SHELL
ref: https://sspai.com/post/63935
-- uninstall arm 64 brew (if needed)
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
-- install x86_64 brew
https://brew.sh/
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
which brew
/usr/local/bin/brew -> x86_64
/opt/homebrew/bin/brew -> arm
-- uninstall x86_64 mysql (if needed)
#Library not loaded: /usr/local/opt/mysql/lib/libmysqlclient.20.dylib
brew services stop mysql
brew uninstall --force mysql
rm -R /usr/local/var/mysql
brew install [email protected]
brew services start [email protected]
brew link [email protected] --force
-- uninstall arm mysql (if needed)
brew uninstall mysql
-- install x86_64 mysql
arch -x86_64 brew install [email protected]
-- install pip (if needed)
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
-- install python envs
mkdir -p ~/workspace/envs;
cd ~/workspace/envs;arch -x86_64 virtualenv -p $(which python) misv2
cd ~/workspace/envs;source ./misv2/bin/activate;cd ~/workspace/misv2
arch -x86_64 $(which python) -m pip install -r requirement.txt
-- x86_64 brew compile MySQL-python driver
env LDFLAGS="-L$(/usr/local/bin/brew --prefix openssl)/lib" CFLAGS="-I$(/usr/local/bin/brew --prefix openssl)/include"
LDFLAGS=-L/usr/local/opt/openssl/lib arch -x86_64 $(which python) -m pip install MySQL-python==1.2.5
ref: https://github.com/PyMySQL/mysqlclient/issues/131
-- run django
arch -x86_64 python manage.py runserver
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment