Homebrew Mac



Jun 15, 2020 Fortunately, Homebrew on Mac includes a subcommand called 'casks' for more complex multi-directory structures. What's especially nice is that cask uses a similar command structure to the standard brew commands, so you can use similar search, install, and info steps.

« back — written by Brent on November 26, 2020
  • Homebrew’s package index. Homebrew Formulae is an online package browser for Homebrew – the macOS (and Linux) package manager. For more information on how to install and use Homebrew see our homepage.
  • I have uninstalled and installed Homebrew 3 times now because it seems to never allow me to install anything as it denies me permissions at the end of most installations. As an example I will post.
  • If you are one of the early developers who adopted M1 Mac and willing to use HomeBrew on the latest silicone chip. Here is a brief tutorial for you to Install and use HomeBrew on M1 Macs Make a duplicate of your Terminal for Rosetta Go to your applications folder and locate your favourite terminal, I use iTerm2, Right click on the terminal icon and choose Duplicate. This will create a copy of.

Tired of managing servers? Check out Serverless Visually Explained by Matthieu Napoli and learn how to create scalable PHP applications on AWS.

# Upgrading with Homebrew

Start by making sure brew is up-to-date:

Next, upgrade PHP. You can either use the built-in php recipe, use tap shivammathur/homebrew-php. I'd recommend the second approach, since it allows you to easily install several PHP versions and switch between them.

# Normal upgrade

# Upgrade with shivammathur/homebrew-php

To switch between versions, use the following command:

You can read more in the repository.

# Next steps

Check the current version by running php -v:

Restart Nginx or Apache:

And make sure that your local web server also uses PHP 8 by visiting this script:

The version should show 8.0.x.

Note: if you're using Laravel Valet, please keep on reading,you need some extra steps in order for the web server to properly work.

# Valet

Homebrew Mac M1

If you're using Laravel Valet, you should do the following steps to upgrade it:

You can use valet use to switch between PHP versions:

Note that if you're using an older Valet version (prior to v2.13.18), when switching from PHP 8 to PHP 7.4 there was a bug that didn't properly update the changes. This was fixed in Valet 2.13.18 so that it now automatically removes the valet socket after having run valet use php@7.4. If you need to do this manually, you can run:

# Extensions

PHP extensions are installed using pecl. I personally use Imagick, Redis and Xdebug. They can be installed like so:

Mac

You can run pecl list to see which extensions are installed:

You can search for other extensions using pecl search:

Make sure to restart your web server after installing new packages:

If you're using Laravel Valet, you should restart it as well.

Make sure all extensions are correctly installed and loaded by checking both your PHP webserver and CLI installs:

If extensions aren't properly loaded, there are two easy fixes.

First, make sure the extensions are added in the correct ini file. You can run php --ini to know which file is loaded:

Now check the ini file:

Note that if you're testing installed extensions via the CLI, you don't need to restart nginx, apache or Valet when making changes to ini settings.

Homebrew Mac Update

The second thing you can do, if you're updating from an older PHP version which also used pecl to install extension; is to reinstall every extension individually.

Homebrew Mac M1

# Last step

Homebrew Mac Os

Finally you should test and upgrade your projects for PHP 8 compatibility.