Local Community

Local 5.1.0 can't seem to update wp cli

When I try to update wp-cli from the installed version 2.2.0 to 2.4.0 I get the following error.

➜  Fawkes: ~/Local_Beta_Sites/lightning/app/public wp cli update
You have version 2.2.0. Would you like to update to 2.4.0? [y/n] y
Downloading from https://github.com/wp-cli/wp-cli/releases/download/v2.4.0/wp-cli-2.4.0.phar...
md5 hash verified: dedd5a662b80cda66e9e25d44c23b25c
	                                                    
	 sh: /Applications/Local: No such file or directory 
	                                                    
	                                                    
Error: The downloaded PHAR is broken, try running wp cli update again.

I understand that /Applications/Local doesn’t exist but shouldn’t it point to the currently running version of Local? In this case /Applications/Local\ Beta.app.

Good catch! I’ve added a note for our team to dig into this.

@afragen,

If you rename Local Beta.app to Local-Beta.app do you have any better luck?

If so, I’m curious if this should be patched in WP-CLI itself. Note the lack of any escaping on $php_binary here: https://github.com/wp-cli/wp-cli/blob/c3e269b1e62b845e45334c76872d02a596eeb675/php/commands/src/CLI_Command.php#L338-L339

Here’s the link to Utils\get_php_binary(): https://github.com/wp-cli/wp-cli/blob/c3e269b1e62b845e45334c76872d02a596eeb675/php/utils.php

I’ll take a look when I get off work. If not having a space in the name is what’s preventing it from updating that could be a marketing issue :wink:

2 Likes

@clay I am both pleased and sorry to inform you that changing the name of the app in the Finder to Local-Beta.app does indeed allow WP-CLI to update. :rofl:

1 Like

@flyjack, time to change the product name :wink:

In all seriousness, thanks for testing it @afragen! We might be able to relocate WP-CLI to another directory to get around this issue.

3 Likes

Andy,

What do you get with “which wp?” Are you using the “Open Site Shell” command to get to a terminal for this? When I do so in Mac on my machine I’m having no issues with wp cli update

It seems to be an issue if there is a space in the app name. When the app was Local.app it works. When the app is named Local Beta.app it doesn’t.

As Local 3.x works in a virtual machine, the app name was irrelevant.

Make sense?

That does. Thanks Andy.

Anytime Chris.

Andy, we’ll have a solution for this in a release soon. The result… you shouldn’t have to run that command anyway so we’re going to make sure each update comes with the latest wp-cli. Thanks for pointing this out.

1 Like

Chris, I must’ve missed the announcement about you joining Flywheel. Congrats! :partying_face:

2 Likes

The upcoming Local Beta releases fixes/addresses this!

1 Like