banner
JackYoung

JackYoung

生活、摄影、写作、代码。
github
bilibili
email

Those pits on M1

Introduction#

I have been using the M1 Pro for almost a year now. I mainly use it for work, studying, photo editing, and occasionally for development. I have become a heavy user of Mac. Here, I will summarize some of the problems I have encountered. If anyone has encountered similar issues, I hope this can provide some inspiration.

Brew Environment#

Initially, I used a 2019 Air Mac with x86 architecture. I had installed brew on that machine. However, when I received the M1, I couldn't wait to migrate my data. To my surprise, many software programs needed to be re-downloaded in the Apple version or required Rosetta to be installed. The most frustrating part was that I couldn't use brew directly. I couldn't find the original installation location and couldn't uninstall it. I also couldn't use the one-click installation from the official website. Later, I found a good solution in a Zhihu post by a fellow user. It was a command-line solution. You can refer to it here.

Django Connecting to MySQL#

Recently, I have been learning Django. I prefer using the Docker version of MySQL. However, after configuring Django's settings.py and installing mysqlclient, when I excitedly ran runserver, I encountered the following error:

At first, I asked ChatGPT about the error. GPT told me that it was a version mismatch issue and advised me to make sure that the version of MySQL matches the version of mysqlclient. I did that, and both were the latest versions, but I still encountered the same error. GPT gave me the same response. Then, in the issue section of PyMySQL, I found a solution. The main problem was that the ARM versions of MySQL and mysqlclient still had issues, so I needed to install the x86 version.

  • First, I needed to reinstall the x86 version of brew.
arch -x86_64 zsh
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  • The default installation location of the ARM version of brew is /opt/homebrew/bin/brew.
  • After executing the installation script, it will prompt you to manually execute two commands to change the location of the currently used brew.
(echo; echo 'eval "$(/usr/local/bin/brew shellenv)"') >> /Users/youngjack/.zprofile
eval "$(/usr/local/bin/brew shellenv)"
  • Now, when you use which brew, you will see that the newly installed x86 brew located at /usr/local/bin/brew is being used.
  • If you want to switch back to the ARM version, just change the location of brew in the manually executed commands to the location of the ARM version.
  • Note: Using the x86 brew requires Rosetta to be installed.
  • Then, reinstall mysqlclient in the python environment and use brew to reinstall MySQL.
brew install mysql
pip uninstall mysqlclient -y
pip install mysqlclient --no-cache-dir
  • Run Django again, and the problem is solved!

Software Installation Error: File is Damaged and Cannot Be Used#

The reason for this error is most likely due to cracked software (I'm broke and can't afford to buy software). You can use the following command:

sudo xattr -r -d com.apple.quarantine <app>
sudo codesign --sign - --force --deep <app>

After that, if there is an option in the security settings to allow the software, just click "Allow".

Pulse Secure#

Due to work requirements, I need to use Pulse Secure VPN. Unfortunately, there is currently no place where you can continuously download the Pulse Secure client for free. Usually, it is provided internally by the company. However, most of the versions provided internally are for Windows. Currently, the only available download link I found is one that can be used. Cherish it because you never know when this link will also become invalid.

Software Recommendations#

  • Excalidraw: An open-source drawing software that simulates handwriting strokes. It also supports collaborative work. I recommend installing their online version locally using Chrome. Just click and use.
  • RunCat: A cute cat that runs on the top bar of the screen. It monitors system resources.
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.