phpmon icon indicating copy to clipboard operation
phpmon copied to clipboard

Check if `valet install` ran at startup

Open marktopper opened this issue 3 years ago • 2 comments

Describe the bug No biggie, just a helpful information to the checks that can help future installs, I spent a few minutes like "wtf" figuring this out cause I didn't read the Valet installation guide, only went with the phpmon error messages xD

To Reproduce Steps to reproduce the behavior:

  1. Clean setup, install phpmon, php, composer and require composer laravel/valet.
  2. Start phpmon
  3. phpmon will say to run ´sudo valet trust´
  4. sudo valet trust, says command not found

Expected behavior phpmon should tell the user to do valet install first. Only after that, the command valet trust can be ran.

Additional context Not a issue, more a check recommendation. Feel free to close.

marktopper avatar Jul 15 '22 07:07 marktopper

Thanks for reporting!

I should be able to add an additional check that verifies whether valet install has been run before (after the check that determines whether the valet binary exists).

nicoverbruggen avatar Jul 16 '22 10:07 nicoverbruggen

I've added this to v5.5. You will get the following message if your configuration directory is missing (a symptom of not having run valet install yet).

valet missing

nicoverbruggen avatar Jul 28 '22 19:07 nicoverbruggen

@nicoverbruggen I get this error message with PHP Monitor v5.5 and Valet v3.1.9 installed and working properly. All previous versions of PHP Monitor worked fine with my valet setup.

Running valet install again and re-installing PHP Monitor a few times didn't help.

jacobmllr95 avatar Aug 28 '22 20:08 jacobmllr95

@nicoverbruggen I get this error message with PHP Monitor v5.5 and Valet v3.1.9 installed and working properly.

Are you the owner of the ~/.config/valet folder that is being checked? From memory I'd say that a permission problem might cause this issue.

Regardless, there's gotta be a reason this check fails!

nicoverbruggen avatar Aug 28 '22 23:08 nicoverbruggen

@nicoverbruggen Yes, I'am the owner of the folder.

Bildschirmfoto 2022-08-29 um 11 02 58 Bildschirmfoto 2022-08-29 um 11 02 44

What exactly is PHP Monitor checking for inside the folder?

jacobmllr95 avatar Aug 29 '22 09:08 jacobmllr95

@jacobmllr95

The check is simply to verify that the directory exists: https://github.com/nicoverbruggen/phpmon/blob/main/phpmon/Domain/App/Startup.swift#L174

Can you confirm it is this check that fails? You can try to run PHP Monitor in verbose mode by running it via the terminal:

open /Applications/PHP\ Monitor.app/Contents/MacOS/PHP\ Monitor

Maybe the output here can help us figure out what's going on. (The terminal should show which startup checks fail, and perhaps some extra information about filesystem/permission issues if those apply.)

I'd expect this check to pass on your system with the information you've provided... strange!

nicoverbruggen avatar Aug 29 '22 09:08 nicoverbruggen

@nicoverbruggen:

jacobmuller@Jacobs-MacBook-Pro ~ % /Applications/PHP\ Monitor.app/Contents/MacOS/PHP\ Monitor ; exit;
==================================
PHP MONITOR by Nico Verbruggen
Version 5.5.0 (951)
==================================
[ARCH] The user is running PHP Monitor with the architecture: arm64
[OK] `/opt/homebrew/bin/brew` exists
[OK] `/opt/homebrew/bin/php` exists
[OK] `ls /opt/homebrew/opt | grep php` returned php result
[OK] `valet` binary exists
[OK] `/private/etc/sudoers.d/brew` contains brew
[OK] `/private/etc/sudoers.d/valet` contains valet
[OK] `sudo /opt/homebrew/bin/brew services info` JSON loaded
[FAIL] `.config/valet` not empty (Valet installed)

jacobmllr95 avatar Aug 29 '22 10:08 jacobmllr95

@jacobmllr95 Internally, the ~ resolves to /Users/$(whoami), perhaps that is an issue on your system?

That's the only thing I can think about that might go wrong here...

ls /Users/$(whoami)/.config/valet

Does that work?


If you ever changed your username or your home directory's path, I suppose it might mismatch $(whoami).

I also just found out that whoami is deprecated on macOS so I need to fix that regardless (see #189). Thanks for reporting, and let me know what's up with your home folder!

nicoverbruggen avatar Aug 29 '22 11:08 nicoverbruggen

@nicoverbruggen You're right. When I initially set up my account Mac OS auto-generated jacobmuller (without the e) and I later changed the user directory to jacobmueller.

EDIT: I've created another admin account and changed the account name to jacobmueller as well and now PHP Monitor is working as expected.

jacobmllr95 avatar Aug 29 '22 11:08 jacobmllr95

When I initially set up my account Mac OS auto-generated jacobmuller (without the e) and I later changed the user directory to jacobmueller.

This is definitely a very uncommon scenario but I will also fix it in #189 later this week.

I've renamed user directories in the past as well, and you shouldn't have to make a new account.

Thanks for reporting, @jacobmllr95!

nicoverbruggen avatar Aug 29 '22 12:08 nicoverbruggen

@nicoverbruggen I wasn't clear enough - I've created the second admin account to be able to change the account name from my original account.

jacobmllr95 avatar Aug 29 '22 12:08 jacobmllr95

@jacobmllr95 This issue is now resolved in v5.5.1! Should your username and home folder (still) differ, the app will now work correctly.

nicoverbruggen avatar Sep 01 '22 15:09 nicoverbruggen