The terminal under Mac can also generate QR code

Sometimes, we need to convert links or texts into QR codes. Usually, we will use online online services to process them. In fact, we can do it even more simply by using the terminal to generate QR codes.

Here, we need to use a library of homebrew under Mac to achieve this, the name of this library is qrencode. The following is about the installation, packaging, and use of this library.

Install

 1 
brew install qrencode

use

 1 
qrencode -t ANSIUTF8 https://droidyue.com

Execute the above statement, and you can immediately see that a QR code is generated on the terminal.

Save as script (qrCodeGenerate.sh)

 1 2 
#!/bin/bash qrencode -t ANSIUTF8 $1

script usage

 1 
qrCodeGenerate.sh https://droidyue.com

Save it as a script to make it easier and faster for us to use it later.

qrencode documentation

droidyue_gzh_green_png.png

This article is reprinted from https://droidyue.com/blog/2022/05/30/generate-qrcode-in-terminal-on-mac-or-linux/
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment