Segmentation fault – Laravel Valet and WP CLI

Recently I installed Laravel valet 2.3.3 and setup WordPress. While running wp cli commands, I faced “Segmentation fault” errors. I googled for the keyword but was not getting any helpful result. What I googled was:

WP CLI segmentation fault error

WordPress WP CLI segmentation fault error while running wp import command

Then I thought this seems to be specific to the environment and not related to WP CLI as such. So after updating the search keyword to:

laravel valet wordpress segmentation fault while running WP CLI command

I got a relevant search result. This comment on the relevant GitHub issue was really helpful.

What I had to do to solve this issue was to remove the existing curl-opnssl version and install the other which does not have this error:

brew remove curl-openssl --ignore-dependencies curl-openssl
brew install

Quickly recording here on my blog so that if any other users face this they may find it helpful 🙂