brew Error: Directory not empty @ dir_s_rmdir – /private/tmp/d20210315-27447-1b2auy5

chown davidr:wheel /private/tmp/

fixed my issue


How to switch PHP version on a mac with brew?

$ brew unlink [email protected] 

$ brew install [email protected]
$ brew link [email protected] --force --overwrite

Type the following to force the php -v to use latest brew php version installed

PATH="/usr/local/opt/[email protected]/bin:$PATH"

The command you provided is used to modify the PATH environment variable in a Unix-like operating system, such as Linux or macOS. The PATH variable is a list of directories that the operating system searches when you enter a command in the terminal.

The command export PATH="/usr/local/opt/[email protected]/bin:$PATH" adds the directory /usr/local/opt/[email protected]/bin to the beginning of the PATH variable. This means that when you run a command in the terminal, the system will check this directory first for the corresponding executable file. If the file is found there, it will be executed. If not, the system will continue searching the remaining directories in the PATH variable.

In this specific case, it appears that the command is adding the directory for the PHP version 8.1 to the PATH. This allows you to use the PHP 8.1 command-line tools and executables conveniently from anywhere in the terminal.