-
Notifications
You must be signed in to change notification settings - Fork 719
Description
Clear description of your problem
Homebrew added support for M1 Macs. As part of that, they're now using /opt/homebrew rather than /usr/local.
Valet still uses the old path in its code.
This causes a couple of issues:
- The
valetbinary doesn't get symlinked into the user'sbin - Valet constantly asks for your password because the path in the sudoers file that
valet trustgenerates points to the wrong place.
Expected behavior
- The path to the correct
bindirectory should be used. - The valet binary should get symlinked to the correct bin directory.
- The valet trust command should write the correct path and stop asking for passwords.
Steps to Reproduce
- Fresh install of MacOS on an M1 mac.
- Install Homebrew
- Install Valet
- Run
valet trust - Open a new terminal so your sudo doesn't carry over from a second ago.
- Run a valet command, see that it asks for your password.
- Symlink
/opt/homebrew/bin/valet - Edit
/etc/sudoers.d/valetto point to/opt/homebrew/bin/valet - New terminal again.
- Run a valet command, but this time it won't ask for a password.
Possible solution
The path is hardcoded here:
Line 11 in 3567612
| var $valetBin = '/usr/local/bin/valet'; |
This'll probably need to be injected.
I imagine it'll need to be a bit more than a "is this an M1, use /opt/homebrew, otherwise /usr/local" because of people that installed Homebrew before the native M1 support, which still would have used /usr/local.
Maybe you can check if the /opt/homebrew directory exists?
There's a few other references to /usr/local. https://github.com/laravel/valet/search?q=%2Fusr%2Flocal
I'm happy to take a stab at a PR when I get time, but I don't know when that'll be. Maybe this will be a simple thing for someone who knows Valet's internals better.
Hope that was helpful, thanks!