Showing posts with label Mac. Show all posts
Showing posts with label Mac. Show all posts

Thursday, 5 October 2023

How to run MySQL server and client using Docker on MacOS


image source: https://factorialcomplexity.com/


To install Docker on MacOS follow these instructions: Install Docker Desktop on Mac | Docker Docs

To run MySQL server in Docker container which is not detached (does not run in background): 

% docker run \
--name my-mysql-container \
-e MYSQL_ROOT_PASSWORD=ok \
-p3306:3306 \
mysql:8.0
 
2023-10-05 14:53:01+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.34-1.el8 started.
2023-10-05 14:53:01+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2023-10-05 14:53:01+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.34-1.el8 started.
2023-10-05 14:53:01+00:00 [Note] [Entrypoint]: Initializing database files
2023-10-05T14:53:01.934152Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
2023-10-05T14:53:01.934254Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.34) initializing of server in progress as process 80
2023-10-05T14:53:01.939114Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-10-05T14:53:02.171938Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-10-05T14:53:02.830346Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2023-10-05 14:53:05+00:00 [Note] [Entrypoint]: Database files initialized
2023-10-05 14:53:05+00:00 [Note] [Entrypoint]: Starting temporary server
2023-10-05T14:53:05.321074Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
2023-10-05T14:53:05.324515Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.34) starting as process 124
2023-10-05T14:53:05.335777Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-10-05T14:53:05.428502Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-10-05T14:53:05.544258Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2023-10-05T14:53:05.544283Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2023-10-05T14:53:05.545082Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2023-10-05T14:53:05.553518Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: /var/run/mysqld/mysqlx.sock
2023-10-05T14:53:05.553570Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.34'  socket: '/var/run/mysqld/mysqld.sock'  port: 0  MySQL Community Server - GPL.
2023-10-05 14:53:05+00:00 [Note] [Entrypoint]: Temporary server started.
'/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
2023-10-05 14:53:06+00:00 [Note] [Entrypoint]: Stopping temporary server
2023-10-05T14:53:06.611355Z 10 [System] [MY-013172] [Server] Received SHUTDOWN from user root. Shutting down mysqld (Version: 8.0.34).
2023-10-05T14:53:08.163907Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.34)  MySQL Community Server - GPL.
2023-10-05 14:53:08+00:00 [Note] [Entrypoint]: Temporary server stopped
2023-10-05 14:53:08+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up.
2023-10-05T14:53:08.821603Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
2023-10-05T14:53:08.822305Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.34) starting as process 1
2023-10-05T14:53:08.825981Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-10-05T14:53:08.895159Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-10-05T14:53:09.030902Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2023-10-05T14:53:09.030930Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2023-10-05T14:53:09.031870Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2023-10-05T14:53:09.039049Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
2023-10-05T14:53:09.039091Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.34'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.
2023-10-05T14:54:46.771871Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 8.0.34).
2023-10-05T14:54:47.855145Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.34)  MySQL Community Server - GPL.

If we want to stop this container, we need to open another terminal and execute:

% docker stop my-mysql-container
my-mysql-container

This does not remove the stopped/exited container which can be verified by listing all containers:

docker container ls -all


If we don't want to re-use (restart) that container, we can remove it:

% docker rm my-mysql-container
my-mysql-container


We can make sure container is removed automatically by passing --rm to docker run.

Once MySQL Docker container is running we can see some of its details if we list all containers:

docker container ls 
CONTAINER ID   IMAGE       COMMAND                  CREATED              STATUS              PORTS                               NAMES
9287fcb65268   mysql:8.0   "docker-entrypoint.s…"   About a minute ago   Up About a minute   0.0.0.0:3306->3306/tcp, 33060/tcp   my-mysql-container


We can see that it's bound to IP address 0.0.0.0 and port 3306.

To connect to this DB instance we can use mysql client. 

We can use brew to install only mysql client (which also includes mysqldamp application):

% brew install mysql-client
...
==> Installing mysql-client
==> Pouring mysql-client--9.4.0.arm64_sequoia.bottle.tar.gz
==> Caveats
mysql-client is keg-only, which means it was not symlinked into /opt/homebrew,
because it conflicts with mysql (which contains client libraries).

If you need to have mysql-client first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/mysql-client/bin:$PATH"' >> /Users/bojan/.zshrc

For compilers to find mysql-client you may need to set:
  export LDFLAGS="-L/opt/homebrew/opt/mysql-client/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/mysql-client/include"
==> Summary
🍺  /opt/homebrew/Cellar/mysql-client/9.4.0: 125 files, 127.8MB
==> Running `brew cleanup mysql-client`...
Disable this behaviour by setting `HOMEBREW_NO_INSTALL_CLEANUP=1`.
Hide these hints with `HOMEBREW_NO_ENV_HINTS=1` (see `man brew`).
==> Caveats
==> mysql-client
mysql-client is keg-only, which means it was not symlinked into /opt/homebrew,
because it conflicts with mysql (which contains client libraries).

If you need to have mysql-client first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/mysql-client/bin:$PATH"' >> /Users/bojan/.zshrc

For compilers to find mysql-client you may need to set:
  export LDFLAGS="-L/opt/homebrew/opt/mysql-client/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/mysql-client/include"


Installation can be verified by checking apps' versions:

% /opt/homebrew/opt/mysql-client/bin/mysql --version
/opt/homebrew/opt/mysql-client/bin/mysql  Ver 8.1.0 for macos13.3 on arm64 (Homebrew)
 
% /opt/homebrew/opt/mysql-client/bin/mysqldump --version
mysqldump  Ver 8.1.0 for macos13.3 on arm64 (Homebrew)

We can now connect to DB:

% /opt/homebrew/opt/mysql-client/bin/mysql -uroot -p -h0.0.0.0    
Enter password: <--enter root's password

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.34 MySQL Community Server - GPL

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 


-p option without value will prompt user to type in the password without it being displayed and also saved in command history. If we don't pass the -p option, we'll get this error:

ERROR 1045 (28000): Access denied for user 'USER'@'<IP ADDRESS>' (using password: NO)


We didn't need to pass port number as we're using a default MySQL port (3306) but we had to pass a host (-h).

To see which users are created for this brand new MySQL instance:

mysql> select host, user, plugin from mysql.user;
+-----------+------------------+-----------------------+
| host      | user             | plugin                |
+-----------+------------------+-----------------------+
| %         | root             | caching_sha2_password |
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session    | caching_sha2_password |
| localhost | mysql.sys        | caching_sha2_password |
| localhost | root             | caching_sha2_password |
+-----------+------------------+-----------------------+
5 rows in set (0.02 sec)


MySQL here actually shows "accounts" which come in format: username@host. So we have here two root accounts, one for connection from localhost only and one for connections from anywhere.

 To list current databases:

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.03 sec)



MySQL Docker container automatically creates and mounts a volume:

% docker inspect my-mysql-container
[
    {
        "Id": "a8a275aa4b15b49702a0fcf080950b0b92b0f7239742ecad0ff3a1fc84e87ba3",
        "Created": "2023-10-05T15:06:55.21292468Z",
        "Path": "docker-entrypoint.sh",
        "Args": [
            "mysqld"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 1632,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2023-10-05T15:06:55.430691972Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Image": "sha256:659ee6cc1dd35b909daead51fbc9010e2252ce16bc260b56b6d709facb844a7b",
        "ResolvConfPath": "/var/lib/docker/containers/a8a275aa4b15b49702a0fcf080950b0b92b0f7239742ecad0ff3a1fc84e87ba3/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/a8a275aa4b15b49702a0fcf080950b0b92b0f7239742ecad0ff3a1fc84e87ba3/hostname",
        "HostsPath": "/var/lib/docker/containers/a8a275aa4b15b49702a0fcf080950b0b92b0f7239742ecad0ff3a1fc84e87ba3/hosts",
        "LogPath": "/var/lib/docker/containers/a8a275aa4b15b49702a0fcf080950b0b92b0f7239742ecad0ff3a1fc84e87ba3/a8a275aa4b15b49702a0fcf080950b0b92b0f7239742ecad0ff3a1fc84e87ba3-json.log",
        "Name": "/my-mysql-container",
        "RestartCount": 0,
        "Driver": "overlay2",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": null,
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "default",
            "PortBindings": {
                "3306/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "3306"
                    }
                ]
            },
            "RestartPolicy": {
                "Name": "no",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "ConsoleSize": [
                83,
                318
            ],
            "CapAdd": null,
            "CapDrop": null,
            "CgroupnsMode": "private",
            "Dns": [],
            "DnsOptions": [],
            "DnsSearch": [],
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "private",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "runc",
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": [],
            "BlkioDeviceReadBps": [],
            "BlkioDeviceWriteBps": [],
            "BlkioDeviceReadIOps": [],
            "BlkioDeviceWriteIOps": [],
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": [],
            "DeviceCgroupRules": null,
            "DeviceRequests": null,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": null,
            "OomKillDisable": null,
            "PidsLimit": null,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0,
            "MaskedPaths": [
                "/proc/asound",
                "/proc/acpi",
                "/proc/kcore",
                "/proc/keys",
                "/proc/latency_stats",
                "/proc/timer_list",
                "/proc/timer_stats",
                "/proc/sched_debug",
                "/proc/scsi",
                "/sys/firmware"
            ],
            "ReadonlyPaths": [
                "/proc/bus",
                "/proc/fs",
                "/proc/irq",
                "/proc/sys",
                "/proc/sysrq-trigger"
            ]
        },
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/45fab3456bae181cec9ccd9958f491dc51594ebee0d8f2c05ea913dfc216373a-init/diff:/var/lib/docker/overlay2/554caa8009fcffb10545ec19f3647ff8f6e4efb76bb6968f88ce4aa4e5a99d93/diff:/var/lib/docker/overlay2/b0504363136d9025c59462da707577865b082f00e32a89bbf904acd2e8fcb0dd/diff:/var/lib/docker/overlay2/1d752f3ab2539a06342fbc75736758e9bed9419abe8c12337b475513a550dbe2/diff:/var/lib/docker/overlay2/dafcf26ab1425cac1c2cbb027b6d98b1c0a3c2219ff017fd60eda1a3cbcc82a5/diff:/var/lib/docker/overlay2/942525d090959c9e107a63b340e3d9ef2cfc562e7db3f4a50baacbdb84e290aa/diff:/var/lib/docker/overlay2/fbbdc662d593c7e1a3129b3d07b579adeca19f6b4eb1a07644baeeb69d08d5d7/diff:/var/lib/docker/overlay2/1b05ad572a1376ace845fde6a4504d0c4fb3feb61c553ec8bec7683ae1462233/diff:/var/lib/docker/overlay2/1150f0ce41e94b651bcb633e3f9c65f3e729d10e1f496473ee3549de929b6c71/diff:/var/lib/docker/overlay2/0b83049e1887b1c36619fff3f47336edc894acb612eb9ab6a8af78f065ac839d/diff:/var/lib/docker/overlay2/211c588f45135714ed24353659529c1d1913e4e47f51654140dce11ad6cb9781/diff:/var/lib/docker/overlay2/119cde52e1eb9760d4ed3e94482b22aa5c02ce7d6082cf7b7cf872e6f243238a/diff",
                "MergedDir": "/var/lib/docker/overlay2/45fab3456bae181cec9ccd9958f491dc51594ebee0d8f2c05ea913dfc216373a/merged",
                "UpperDir": "/var/lib/docker/overlay2/45fab3456bae181cec9ccd9958f491dc51594ebee0d8f2c05ea913dfc216373a/diff",
                "WorkDir": "/var/lib/docker/overlay2/45fab3456bae181cec9ccd9958f491dc51594ebee0d8f2c05ea913dfc216373a/work"
            },
            "Name": "overlay2"
        },
        "Mounts": [
            {
                "Type": "volume",
                "Name": "dc3ba28061ef18cc37f4472804ac3d7a30b305fea0f364815e5efcd55ad71401",
                "Source": "/var/lib/docker/volumes/dc3ba28061ef18cc37f4472804ac3d7a30b305fea0f364815e5efcd55ad71401/_data",
                "Destination": "/var/lib/mysql",
                "Driver": "local",
                "Mode": "",
                "RW": true,
                "Propagation": ""
            }
        ],
        "Config": {
            "Hostname": "a8a275aa4b15",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": true,
            "AttachStderr": true,
            "ExposedPorts": {
                "3306/tcp": {},
                "33060/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "MYSQL_ROOT_PASSWORD=ok",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "GOSU_VERSION=1.16",
                "MYSQL_MAJOR=8.0",
                "MYSQL_VERSION=8.0.34-1.el8",
                "MYSQL_SHELL_VERSION=8.0.34-1.el8"
            ],
            "Cmd": [
                "mysqld"
            ],
            "Image": "mysql:8.0",
            "Volumes": {
                "/var/lib/mysql": {}
            },
            "WorkingDir": "",
            "Entrypoint": [
                "docker-entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": {}
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "d43214351095b716cc00d79d20f32389e95e3b62808d252c42036b567903b9c0",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "3306/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "3306"
                    }
                ],
                "33060/tcp": null
            },
            "SandboxKey": "/var/run/docker/netns/d43214351095",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "cdc7d50bcb9a5c0be31aba3c3d2fd5726996bd5870801675250f48b02eaef278",
            "Gateway": "172.17.0.1",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "172.17.0.2",
            "IPPrefixLen": 16,
            "IPv6Gateway": "",
            "MacAddress": "02:42:ac:11:00:02",
            "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "a2a205d498dcc308e419b7785da1e2ebce4da2f962df0b83f5c98f8aef9a5759",
                    "EndpointID": "cdc7d50bcb9a5c0be31aba3c3d2fd5726996bd5870801675250f48b02eaef278",
                    "Gateway": "172.17.0.1",
                    "IPAddress": "172.17.0.2",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:11:00:02",
                    "DriverOpts": null
                }
            }
        }
    }
]


If we want to prevent manual typing of the password but also not specifying it in the terminal command (so it does not show in history) we can create a config file where mysql will be sourcing username and password for MySQL server.

 % vi ~/.my.cnf                                                                                                                            
[mysqldump]
user=user1
password=pass1

[mysql]
user=user1
password=pass1

We can now run mysql without specifying credentials in command line: 

% /opt/homebrew/opt/mysql-client/bin/mysql --defaults-extra-file=~/.my.cnf ...


Similarly, we can run mysqldump:

% /opt/homebrew/opt/mysql-client/bin/mysqldump --host=... --port=3306 --all-databases --skip-triggers > db-dump.sql

---

...

Monday, 20 December 2021

Installing Python3 on Mac Big Sur

Mac comes with Python 2 by default and I wanted to install and use Python 3. I installed it by using brew

% brew install python3
Running `brew update --preinstall`...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae
abi-compliance-checker     gotify                     pam-reattach
abi-dumper                 hurl                       payload-dumper-go
biber                      imap-backup                pip-audit
brigade-cli                isa-l                      pocsuite3
chroma                     jsonschema                 rpki-client
coursier                   kubernetes-cli@1.22        salt-lint
djhtml                     lua-language-server        sevenzip
dynomite                   mcfly                      statix
fastp                      mist                       tsduck
goawk                      openliberty-jakartaee9     vtable-dumper
goplus                     openliberty-webprofile9
==> Updated Formulae
Updated 1431 formulae.
==> Deleted Formulae
ape             es              jerasure        makepp          swiftplate
balance         eventlog        kakasi          marst           torrentcheck
bbcolors        flasm           l-smash         mboxgrep        udns
colorsvn        fondu           libbind         md              whitedb
contacts        gconf           liberasurecode  namazu          xidel
csv-fix         gcore           libmill         postmark        xtail
dlite           gf-complete     libopendkim     redsocks        zdelta
dnsrend         git-hooks       libpuzzle       sdhash
drip            git-sh          libvbucket      shorten
dshb            henplus         m2c             srmio
eject           httptunnel      magnetix        svdlibc
==> New Casks
appflowy            finalshell          projector           teamspeak-client
appium-inspector    folder-colorizer    schildichat         tidgi
centered            grammarly-desktop   sitala              volley
citrix-workspace    handyprintpro       soundtoys           wolai
cron                linearmouse         spaceid             xstation5
emmetapp            ludwig              supermjograph
equinox             macrorecorder       tablecruncher
==> Updated Casks
Updated 648 casks.
==> Deleted Casks
air-connect                              lelivrescolairefr
aja-system-test                          napari
anka-build-cloud-registry                octoscreen
asc-timetables                           platelet
avast-secureline-vpn                     pullover
chameleon-ssd-optimizer                  punto-switcher
chocolat                                 qit
domainbrain                              river-sparkle
drama                                    scrutiny
everweb                                  tmnotifier
freeter                                  unity-linux-support-for-editor
gitbook                                  unity-lumin-support-for-editor
inboard                                  visicut

python@3.9 3.9.6 is already installed but outdated (so it will be upgraded).
==> Downloading https://ghcr.io/v2/homebrew/core/gdbm/manifests/1.22
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/gdbm/blobs/sha256:7e9737ec99942
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/manifests/2021-
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/blobs/sha256:1b
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/openssl/1.1/manifests/1.1.1m
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/openssl/1.1/blobs/sha256:ad0413
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/readline/manifests/8.1.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/readline/blobs/sha256:c596199dc
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/sqlite/manifests/3.37.0
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/sqlite/blobs/sha256:ae0b38a858a
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.9/manifests/3.9.9
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.9/blobs/sha256:4b56d09
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Upgrading python3
  3.9.6 -> 3.9.9 

==> Installing dependencies for python@3.9: gdbm, ca-certificates, openssl@1.1, readline and sqlite
==> Installing python@3.9 dependency: gdbm
==> Pouring gdbm--1.22.big_sur.bottle.tar.gz
🍺  /usr/local/Cellar/gdbm/1.22: 24 files, 957.9KB
==> Installing python@3.9 dependency: ca-certificates
==> Pouring ca-certificates--2021-10-26.all.bottle.tar.gz
==> Regenerating CA certificate bundle from keychain, this may take a while...
🍺  /usr/local/Cellar/ca-certificates/2021-10-26: 3 files, 208.5KB
==> Installing python@3.9 dependency: openssl@1.1
==> Pouring openssl@1.1--1.1.1m.big_sur.bottle.tar.gz
🍺  /usr/local/Cellar/openssl@1.1/1.1.1m: 8,081 files, 18.5MB
==> Installing python@3.9 dependency: readline
==> Pouring readline--8.1.1.big_sur.bottle.tar.gz
🍺  /usr/local/Cellar/readline/8.1.1: 48 files, 1.6MB
==> Installing python@3.9 dependency: sqlite
==> Pouring sqlite--3.37.0.big_sur.bottle.tar.gz
🍺  /usr/local/Cellar/sqlite/3.37.0: 11 files, 4.3MB
==> Installing python@3.9
==> Pouring python@3.9--3.9.9.big_sur.bottle.tar.gz
==> /usr/local/Cellar/python@3.9/3.9.9/bin/python3 -m ensurepip
==> /usr/local/Cellar/python@3.9/3.9.9/bin/python3 -m pip install -v --no-deps -
==> Caveats
Python has been installed as
  /usr/local/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /usr/local/opt/python@3.9/libexec/bin

You can install Python packages with
  pip3 install <package>
They will install into the site-package directory
  /usr/local/lib/python3.9/site-packages

tkinter is no longer included with this formula, but it is available separately:
  brew install python-tk@3.9

See: https://docs.brew.sh/Homebrew-and-Python
==> Summary
🍺  /usr/local/Cellar/python@3.9/3.9.9: 3,080 files, 55.0MB
==> `brew cleanup` has not been run in the last 30 days, running now...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Removing: /usr/local/Cellar/gdbm/1.20... (24 files, 825.0KB)
Removing: /Users/bojan/Library/Caches/Homebrew/gdbm--1.20... (221KB)
Removing: /Users/bojan/Library/Caches/Homebrew/mpdecimal--2.5.1... (548.3KB)
Removing: /usr/local/Cellar/openssl@1.1/1.1.1k... (8,071 files, 18.5MB)
Removing: /Users/bojan/Library/Caches/Homebrew/openssl@1.1--1.1.1k... (5.4MB)
Removing: /usr/local/Cellar/python@3.9/3.9.6... (3,085 files, 54.7MB)
Removing: /Users/bojan/Library/Caches/Homebrew/python@3.9--3.9.6... (13.6MB)
Removing: /usr/local/Cellar/readline/8.1... (48 files, 1.6MB)
Removing: /Users/bojan/Library/Caches/Homebrew/readline--8.1... (536KB)
Removing: /Users/bojan/Library/Caches/Homebrew/rtmpdump--2.4+20151223_1... (170.2KB)
Removing: /usr/local/Cellar/sqlite/3.36.0... (11 files, 4.2MB)
Removing: /Users/bojan/Library/Caches/Homebrew/sqlite--3.36.0... (2MB)
Removing: /Users/bojan/Library/Caches/Homebrew/xz--5.2.5... (417.6KB)
Removing: /Users/bojan/Library/Caches/Homebrew/you-get--0.4.1536... (2.2MB)
Removing: /Users/bojan/Library/Caches/Homebrew/xz_bottle_manifest--5.2.5... (5.7KB)
Removing: /Users/bojan/Library/Caches/Homebrew/rtmpdump_bottle_manifest--2.4+20151223_1... (7KB)
Removing: /Users/bojan/Library/Caches/Homebrew/sqlite_bottle_manifest--3.36.0... (5.9KB)
Removing: /Users/bojan/Library/Caches/Homebrew/openssl@1.1_bottle_manifest--1.1.1k... (6KB)
Removing: /Users/bojan/Library/Caches/Homebrew/python@3.9_bottle_manifest--3.9.6... (15.4KB)
Removing: /Users/bojan/Library/Caches/Homebrew/readline_bottle_manifest--8.1... (5.5KB)
Removing: /Users/bojan/Library/Caches/Homebrew/you-get_bottle_manifest--0.4.1536... (11.2KB)
Removing: /Users/bojan/Library/Caches/Homebrew/gdbm_bottle_manifest--1.20... (5.2KB)
Removing: /Users/bojan/Library/Caches/Homebrew/mpdecimal_bottle_manifest--2.5.1... (5.2KB)
Removing: /Users/bojan/Library/Logs/Homebrew/gdbm... (64B)
Removing: /Users/bojan/Library/Logs/Homebrew/mpdecimal... (64B)
Removing: /Users/bojan/Library/Logs/Homebrew/rtmpdump... (64B)
Removing: /Users/bojan/Library/Logs/Homebrew/readline... (64B)
Removing: /Users/bojan/Library/Logs/Homebrew/sqlite... (64B)
Removing: /Users/bojan/Library/Logs/Homebrew/xz... (64B)
Removing: /Users/bojan/Library/Logs/Homebrew/openssl@1.1... (64B)
Removing: /Users/bojan/Library/Logs/Homebrew/you-get... (64B)
Removing: /Users/bojan/Library/Logs/Homebrew/python@3.9... (2 files, 2.4KB)
Pruned 0 symbolic links and 2 directories from /usr/local
==> Upgrading 1 dependent:
Disable this behaviour by setting HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
you-get 0.4.1536 -> 0.4.1555
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.10/manifests/3.10.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.10/blobs/sha256:c4f29a
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/you-get/manifests/0.4.1555
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/you-get/blobs/sha256:df0dc12c74
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Upgrading you-get
  0.4.1536 -> 0.4.1555 

==> Installing dependencies for you-get: python@3.10
==> Installing you-get dependency: python@3.10
==> Pouring python@3.10--3.10.1.big_sur.bottle.tar.gz
==> /usr/local/Cellar/python@3.10/3.10.1/bin/python3 -m ensurepip
==> /usr/local/Cellar/python@3.10/3.10.1/bin/python3 -m pip install -v --no-deps
🍺  /usr/local/Cellar/python@3.10/3.10.1: 3,132 files, 56MB
==> Installing you-get
==> Pouring you-get--0.4.1555.big_sur.bottle.tar.gz
==> Caveats
To use post-processing options, run `brew install ffmpeg` or `brew install libav`.
==> Summary
🍺  /usr/local/Cellar/you-get/0.4.1555: 736 files, 8.5MB
==> Running `brew cleanup you-get`...
Removing: /usr/local/Cellar/you-get/0.4.1536... (845 files, 8.6MB)
==> Checking for dependents of upgraded formulae...
==> No broken dependents found!
==> Caveats
==> python@3.9
Python has been installed as
  /usr/local/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /usr/local/opt/python@3.9/libexec/bin

You can install Python packages with
  pip3 install <package>
They will install into the site-package directory
  /usr/local/lib/python3.9/site-packages

tkinter is no longer included with this formula, but it is available separately:
  brew install python-tk@3.9

See: https://docs.brew.sh/Homebrew-and-Python
==> you-get
To use post-processing options, run `brew install ffmpeg` or `brew install libav`.


If zsh configuration file does not exist, create it and open it:

% touch ~/.zshrc
% vi ~/.zshrc

Type in it:

export PATH=/usr/local/opt/python@3.9/libexec/bin:$PATH

Restart the terminal.

% which python
/usr/local/opt/python@3.9/libexec/bin/python
% python --version
Python 3.9.9

If using VSCode, restart it and it will also pick up this version of Python in its Terminal.