Getting `No such file or directory` when executing any terminal command (caused by VMware Fusion)
Asked Answered
P

3

5

I am using macOS High Sierra and I am getting the following error when trying to install a script:

 sh: Fusion.app/Contents/Public:/Users/<name>/.rvm/bin: No such file or directory

Apparently has something to do either with rvm or Fusion.app, which I don't have that app, what I have is VMWare Fusion.app.

Papagena answered 8/4, 2018 at 20:58 Comment(0)
P
16

VMWare changes your $PATH variable, but it does not do in .profile, or /etc/profile, neither the globals or locals bashrc or zshrc files.

It has its own file inside /etc/paths.d. The file is called com.vmware.fusion.public.

You need sudo rights to change the file:

$ sudo vim /etc/paths.d/com.vmware.fusion.public

The file is readonly and it has as content:

/Applications/VMware Fusion.app/Contents/Public

Notice there are not quotes around it, and the space character is not escaped. You need to add a \ after the VMWare and before the white space.

Final result:

/Applications/VMware\ Fusion.app/Contents/Public

Quit vim with :x!.

Open a new terminal window and run your command again, you should not have that error anymore.

Papagena answered 8/4, 2018 at 20:58 Comment(3)
Unfortunately newer versions of VMware Fusion now rewrite this value every time it is launched. It's quite annoying. The only solution right now is to rename the application itself to "VMWare-Fusion.app" or "VMWareFusion.app" (for example)Gid
Should someone let them know so that this doe not come back with every update?...Fendig
I just checked with the VMware Fusion team and posted my answer below.Greenshank
S
1

With VMware Fusion rewriting /etc/paths.d/com.vmware.fusion.public on launch;

Adding this PATH find and replace line to my .bash_profile seems to be working:

export PATH=${PATH//VMware\ F/VMware\\ F}

Sparteine answered 24/5, 2020 at 4:5 Comment(0)
G
0

This happens because some shell script (in this case perhaps rvm) is not following best practices, specifically:

Double quote to prevent globbing and word splitting https://github.com/koalaman/shellcheck/wiki/SC2086

Changing /etc/paths.d/com.vmware.fusion.public as suggested in other answers could break all other places where this variable is wrapped in double quotes.

Greenshank answered 14/2, 2022 at 9:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.