How to Migrate from Homestead to Valet

I am going to show step by step on how to install Valet on your Mac. I tested this on MacOS Mojave.

Before this I encounter these errors:

  1. Could not symlink, /usr/local/bin is not writable
  2. In Brew.php line 187: Unable to determine linked PHP
  3. compact() not defined

It turns out that Laravel does not support PHP 7.3 yet. (At least that’s in my case). 

Here’s the step you need to do first. You have to make sure you use the right PHP which is version 7.2.

# Will show you any php packages you've got. make not of that!
brew list | grep php
# Will uninstall any php packages you may have
brew list | grep php | while read x; do brew uninstall --force $x; done
# You may need to run this too
rm -rf /usr/local/Cellar/php
# Clean up Launch Agents
rm ~/Library/LaunchAgents/homebrew.mxcl.php*
sudo rm /Library/LaunchDaemons/homebrew.mxcl.php*
brew untap homebrew/php
brew cleanup
brew update
brew doctor # just to make sure you're all clean
ps ax | grep php
# if some PHP daemons are still runing, reboot.

Now, you can install PHP 7.2 by running this command:

brew install php@7.2

after that, you have to do this:

ln -s /usr/local/Cellar/php@7.2/7.2.13 /usr/local/bin/php

After that, you have to do these:

composer global require laravel/valet

After that, you can use the instructions found on Laravel website.

Leave a Reply