Reprinted from Liu Yue’s Technology Bloghttps://v3u.cn/a_id_187

Like the aircraft carriers suddenly born in the age of great navigation, Apple played with the M1 chip, which was far ahead of its time, and smiled at Intel and said, “I’m sorry, but you play desktop chips, but game over from today. X86? Give it a break.”

Fifteen years ago, the iPhone was born suddenly, and Steve Jobs told the world what a real smart phone was. Ten years ago, the A4 processor was introduced, and the iPhone instantly added its new power. Since then, no friendly business dared to mention the word performance in front of Apple. In people’s minds, a Pad is synonymous with an iPad. Android tablet? It doesn’t exist. Today, Apple Silicon is on the scene, not to mention the awesome performance of the M1, not to mention the super-long battery life of more than 10 hours, and the smooth, non-lag FCPX fast editing experience, just running X86 applications virtually through Rosetta 2 is enough to amuse people. However, these perks are Apple’s bounty for product-level users. As a developer, and a full-stack developer, can M1 handle the complexity of the development environment? As one R&D colleague put it: “Hi, dude, you’re not going to spend $10,000 on an iPad with a second control keyboard, are you? The IQ tax is a bit high.”

First is the development environment of Python3, python’s official website has released adapter M1 chip version 3.9, https://www.python.org/downlo… The author migrated the development environment (x86) from the old Mac Book Pro directly through the migration assistant, which was Python 3.7.4 on the original computer. Surprisingly, most of the base libraries can be used through Rosetta 2. Except for a slight lag in the first operation:

Liuyue :~ liuyue$python3 Python 3.7.4 (v3.7.4:e09359112e, Jul 8 2019, 14:54:52) [Clang 6.0 (Clang-600.0.57)] on Darwin Type "help", "copyright", "credits" or "license" for more information. >>> import pandas >>> import cv2 >>> import numpy >>> import matplotlib >>>  import nltk >>> import ssl >>> from nltk.stem.lancaster import LancasterStemmer

However, some deep learning frameworks such as TensorFlow are not available. The solution is to download M1 compatible version 3.9 from the website, and then download TensorFlow 2.4 which supports M1 chip from https://link.zhihu.com/?targe… \_and\_install.sh. In other words, if you want to train your model with TensorFlow, you will have to upgrade the Python version. However, many TensorFlow projects are used in conjunction with Web applications. The original projects have to be deployed separately, and the interfaces have to be refactored, especially for “heirloom” projects, which increases the cost of development.

As for testing, Selenium is one of the automated testing tools that we often use for a wide range of scenarios. But in M1 system, can we control ARM64 version of Chrome via Rosetta 2 virtual Python 3.7? Answer is possible, because the chromedriver already adaptation of M1 chip, download driver: http://npm.taobao.org/mirrors… Note to select the M1 version of the driver, then unzip it and copy the ChromeDriver file to the system directory:

sudo mv chromedriver /usr/local/bin

Then launch the browser:

From Selenium import webdriver import time # Selenium screenshot driver = webdriver.chrome () driver.get('https://v3u.cn') time.sleep(3) driver.close()

The problem isn’t that big, so if you’re just using the M1 Mac to write automated test scripts or crawlers, it won’t be too stressful, but if you’re testing the results of a scientific calculation, you might have to wrestle with it.

As for virtual machines, they can be used by both test and operation staff, because some applications show different effects in Win and Mac systems. Currently, VMware and Parallels, the two giants of virtual machines, are racing to adapt them. Parallels is one step ahead. First release the beta version of the virtual machine compatible with M1 chips, but need to register first to receive a registration code: https://b2b.parallels.com/app…

Then download the installation package on the page for installation. One thing to note is that the registration code must be recorded when registering, otherwise it will be embarrassing if there is no code to activate after successful installation.

At the same time Microsoft has duly issued based on arm kernel win10 beta mirror, download address: https://www.microsoft.com/en-… Of course, due to some well-known academic problems, the download speed is not very satisfactory. I have uploaded the installation package and the mirror image to the network disk, which will be posted at the bottom of this article.

After Parallels is installed, you can import the ARM version of Win10 image and install it. It only takes about 5 minutes to install successfully:

Although this is a beta version, it runs very smoothly on the whole. Don’t forget to add the default Chinese language pack to the system:

Playing virtual machines on the M1 Mac is almost non-sluggish, amazingly smooth, fans don’t move, power consumption doesn’t increase significantly, and battery life doesn’t decrease much because of the virtual machine, which is one of the most amazing things about the M1.

If you want to develop on a Mac, the package management tool Homebrew is an unavoidable step, so if you are using a migration assistant to migrate an older x86 architecture directly to an M1 Mac, it is best not to use it. There will be a lot of problems. The solution is to install the ARM version of Homebrew

Execute the installation command:

/bin/bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install.sh)"

The ARM-based Homebrew is installed in the system’s /opt/ Homebrew directory, mainly to distinguish it from the older x86.

Then add the environment variable:

echo export PATH=/opt/homebrew/bin:$PATH >> ~/.bash_profile   
source ~/.bash_profile

Then execute:

liuyue:~ liuyue$ brew update  
Already up-to-date.  
liuyue:~ liuyue$

If return Already the up – to – date. Is no problem, about 7 into Homebrew are basically about software support M1 chips, specific adapter list can refer to: https://github.com/Homebrew/b…

For those of you who don’t care, consider Rosetta. Let’s take a look at the process of using Homebrew ARM version to install REIDS.

Installation command:

brew install redis

Usually BREW will get the latest stable version. After successful installation, check the list of software:

LIUYUE :~ LIUYUE $BREW List [email protected] Redis LIUYUE :~ LIUYUE $

Start the service at this point:

Liyue :bin liyue $redis-server 36148:C 24 Feb 2021 21:13:48.673 # oo0ooo0oo redis is starting oo0ooo0oooo036148 :C 24 FEB 2021 21:13:48.673 # Redis version=6.2.0, bits=64, commit=00000000, modified=0, pid=36148, Just Started 36148:C 24 FEB 2021 21:13:42.673 # WARNING: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf 36148:M 24 Feb 2021 21:13:48.673 * Increased maximum number of open files to 10032 (it was originally set to 256). 36148:M 24 Feb 2021 21:13:48. 673 * monotonic clock: POSIX clock_gettime _) _ _) - ` ` __ '- _ _. - ` ` `. ` _.' '- _ Redis 6.2.0 (00000000/0), 64 - bit. - ` `. - ` ` `. ` ` ` \ / _, _' -. _ ( ' , .-` | `, ) Running in standalone mode |`-._`-... - ` __... -.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 36148 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | http://redis.io `-._ `-._`-.__.-'_.-' _. - '| ` - _ ` - _ ` - __. -' _. - '_. -' | | ` - _ ` - _ _. - '_. -' | ` - _ ` - _ ` - __. - '_. -' _. - '` - _ ` -. __. -' _. - '` -) _ _) -' ` - __. - '

Then open another command line connection to the service:

LIUYUE :~ LIUYUE $REDIS-CLI 127.0.0.1:6379> Ping Pong 127.0.0.1:6379>

As you can see, there is no difference between the use of x86 BREW and that of x86 BREW, but the software above is more or less buggy, so be careful when using it.

If you find the ARM version of BREW too slow, you can set a separate domestic source:

git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git git -C "$(brew --repo homebrew/core)"  remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile source ~/.bash_profile

The mirror image of University of Science and Technology of China is a little bit more plausible.

Some students say that there are still 30% of the software how to do? In addition, it seems that ARM BREW is not intended to be used with older versions such as Python 3.7. In fact, it is possible to install an x86 version of BREW on an M1 Mac and install an x86 version of Homebrew:

arch -x86_64 /bin/bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install.sh)"

When installed, it is still in /usr/local/bin/brew, so it is different from /opt/homebrew/bin/brew

Execute the command:

LIUYUE :~ LIUYUE $/usr/local/bin/brew list autoconf GMP libtool [email protected] Siege Automake ICU4C LIUYUE :~ LIUYUE $/usr/local/bin/brew list autoconf GMP libtool [email protected] Siege Automake ICU4C LIBYAML perl sqlite Boost ISL lua pkg-config rift coreutils libevent mkcert [email protected] Trash GCC libgpG-error MPFR readline xz GDBM libksba mtr redis yarn gettext libmpc node ruby zlib

As you can see, these are some of the software I migrated from my old x86 computer. Most of it didn’t work, like Redis, while the new Redis installed with ARM based BREW will work:

Liuyue :~ liuyue$/opt/homebrew/bin/brew list [email protected] redis

/opt/homebrew/bin/brew for new packages, /usr/local/bin/brew for old ones

Then look at the Docker Docker official for adapter or attaches great importance to the M1, earlier put out a beta client: https://docs.docker.com/docke…

You can not only pull the ARM version of the image, but also operate Kubernetes. If you are not familiar with Kubernetes, you can refer to this article: An inch of an inch of blood in the downtime, hundreds of thousands of soldiers container | Win10 / Mac system based on Kubernetes (k8s) build Gunicorn + Flask Web high availability cluster.

However, it is a pity that Docker Hub does not support many images of ARM version, generally about 30% or 40% of x86 images. However, it can be seen that major manufacturers attach great importance to M1, and basically there are official information about adaptation.

Other languages, such as Go Lang, Ruby, and PHP, suffer from the same problem as Python, which is that older versions don’t support the ARM kernel and only use one or two more recent versions, which leads to downward compatibility issues if you switch computers.

For common development software such as VS Code and Sublime 3, PHP suite XAMPP runs without any problems. The version control client Sourcetree, database client Navicat, WeChat, QQ, SSH client iTerm 4 and FTP client FileZilla all work fine. There is still a chance that the front-end WeChat small program development tool will flash back. Tencent did not fit Big Sur well from the beginning. M1, let alone M1.

The latest version of Photoshop, version 2021, does not yet support the M1 chip. Instead, it will have to make do with the 2019 version. In contrast, the FCPX10.5 is a perfect version.

In conclusion, if you are a beginner, just want to learn some language syntax, not going to write some complex industrial projects, consider of M1, it will be a good helper for you started, but if you have hung in the industry for many years, often compiled some complex code, all kinds of libraries, and some even hand “ancestral code” project in maintenance, Then the x86 Mac may be around for another year or two.

Finally, the above mentioned M1 chip to fit the installation package and image please move:

Link: https://pan.baidu.com/s/12d7fHl\_ZYyx4Xk-v0R0N\_g password: 1 FDC need students to download

Bottom line: Sometimes when we praise a piece of technology, we call it an industry benchmark, a textbook, or something like that, but for the M1 Mac Book, it feels like it has transcended that benchmark and become a timeless classic. Apple as the perfect hexagon warriors, are still in exploration, is still not back, continue to explore new roads, continue to study the feasibility of this revelation is that it brings to us, however, in the spring of 2021, in the face of the developer, M1 chip is a bit like earl’s tragedy, it can be used moving very much impressed by developers, But in the last second could not help but look back, the last chance to save his beloved wife Oli Dike, obviously, it has been hard enough, but still a little bit, almost, but I believe that the gods have already written down four words in the life of M1: doomed to glory.

The original article is reprinted from Liu Yue’s Technology Blog https://v3u.cn/a_id_187