Skip to content
This repository was archived by the owner on May 9, 2024. It is now read-only.

Conversation

@ggutenberg
Copy link

Description of the Change

This fixes an issue where, on MacOS Ventura (possibly others), if ~/Library/Application Support/mkcert/rootCA.pem doesn't already exist, a hidden sudo prompt occurs, and the installation hangs forever.

I attempted to use the sudo.exec() method, but it causes an error to be thrown - SecTrustSettingsSetTrustSettings: The authorization was denied since no user interaction was possible - which seems related to this https://developer.apple.com/forums/thread/671582 .

How to test the Change

  1. Be on a Mac, running Ventura.
  2. Delete ~/Library/Application Support/mkcert/ from your computer.
  3. Run sudo -k to make sure sudo isn't cached.
  4. Run npm uninstall -g wp-local-docker to fully remove it.
  5. Run npm i -g wp-local-docker to install it from the NPM Registry. Note that after a few mins it just stops. Behind the scenes it's waiting for a sudo password.

To test this branch:

  1. Repeat steps 1-4 above.
  2. Switch to this branch and cd to the root of this repo.
  3. Edit src/commands/postinstall.js and comment out the return statement on line 16. If you don't do this, the local installation will exit before making it to the problem command.
  4. Run npm i. You will be prompted for your sudo password when npm run postinstall is executed, and this will carry through to the mkcert command.
  5. Once complete, verify that you have ~/Library/Application Support/mkcert/rootCA.pem.

Changelog Entry

Fixed - Installation from NPM Registry would sometimes hang on mkcert

Credits

Props @ggutenberg

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@ggutenberg ggutenberg marked this pull request as draft November 22, 2022 17:22
@ggutenberg
Copy link
Author

It seems that this fix works when running npm i, but not when running npm i -g .. In the latter case, it still hangs silently on sudo. I'm not sure of another programmatic fix for this. An alternate approach is to simply run sudo ls and enter your sudo password before installing this package altogether so that it uses the cached sudo credentials.

I'm open to other suggestions.

@cr0ybot
Copy link

cr0ybot commented Jan 24, 2024

@ggutenberg Thanks for mentioning the workaround of running sudo ls before npm i -g wp-local-docker, this finally allowed the install to finish (and it even prompted for password/biometrics) on my Mac running Sonoma 14.0.

Before this workaround, attempted installs were showing symptoms of issues like #336 and #314.

@jeffpaul jeffpaul requested a review from darylldoyle February 15, 2024 21:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants