Macos M1 Ventura 13.0.1 Elastic agent install fail

I installed the elastic agent on macos Ventura 13.0.1 using the command line and the installation failed showing:

panic: getwd: invalid argument

goroutine 1 [running]:

github.com/elastic/elastic-agent/internal/pkg/agent/application/paths.retrieveExecutablePath()

github.com/elastic/elastic-agent/internal/pkg/agent/application/paths/common.go:197 +0x148

github.com/elastic/elastic-agent/internal/pkg/agent/application/paths.initialTop()

github.com/elastic/elastic-agent/internal/pkg/agent/application/paths/common.go:183 +0x20

github.com/elastic/elastic-agent/internal/pkg/agent/application/paths.init.0()

github.com/elastic/elastic-agent/internal/pkg/agent/application/paths/common.go:41 +0x20

Command used:
sudo . /elastic-agent install --url=https://xx.xx --enrollment-token=xx --insecure --force

What is the solution to this?

which version of elastic-agent are you trying to install?

Also, just to double check. Are you using the aarch64 version or the x86_64 version?

Also does the Terminal application that you are installing from have Full Disk Access? We have seen the install fail on Ventura when it doesn't.