3

I recently installed VMware Fusion 10 on a Mac running macOS 10.12.6. After doing so, my bash PATH is broken. I traced the problem to a /etc/paths.d path file that Fusion installed; it contains the following entry (with no newline):

/Applications/VMware Fusion.app/Contents/Public

Note the space in the pathname. With this present, on starting a shell I get an error:

-bash: export: `Fusion.app/Contents/Public:/Library/TeX/texbin': not a valid identifier

And my resulting PATH is corrupted. I tried adding a newline, putting the path in double-quotes, and putting a backslash before the space; all of these produce an error (sometimes different errors). For example, adding the backslash or wrapping with double-quotes gives the same error. Both changes together gives:

-bash: test: /Users/loredo/Library/Commands:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/VMware: binary operator expected
-bash: test: /Users/loredo/Library/Commands:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/VMware: binary operator expected
-bash: test: /usr/local/var/rbenv/shims:/Users/loredo/Library/Commands:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/VMware: binary operator expected
-bash: export: `Fusion.app/Contents/Public:/Library/TeX/texbin:.:/usr/texbin:/usr/local/cuda/bin': not a valid identifier

I'm beginning to wonder if path_helper may be unable to handle such a use case. Is there a way to handle this?

  • My /etc/paths.d/com.vmware.fusion.public contains /Applications/VMware Fusion.app/Contents/Public and in Terminal echo $PATH outputs: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public I have no problem with my PATH or executing e.g. vmrun, which is in the /Applications/VMware Fusion.app/Contents/Public directory, so having the space is not an issue. Your PATH is being messed up elsewhere! Have you modified /etc/paths or have you added a ~/.bash_profile or ~/.profile and if so are you modifying the PATH in any of these files? – user3439894 Jan 26 '18 at 4:00
  • In Terminal, what is the output of echo $PATH? – user3439894 Jan 26 '18 at 4:01
  • Thanks, @user3439894, your hunch was right. Some ancient PATH manipulation crud in my .profile on that machine was at fault. Updating it fixed the problem. If you post this as an answer I'll happily select it. – Tom Loredo Mar 28 '18 at 17:38
1

My /etc/paths.d/com.vmware.fusion.public contains:

 /Applications/VMware Fusion.app/Contents/Public

In Terminal, echo $PATH outputs:

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public

I have no problem with my PATH or executing e.g. vmrun, which is in the /Applications/VMware Fusion.app/Contents/Public directory, so having the space is not an issue. Your PATH is being messed up elsewhere!

Have you modified /etc/paths or have you added a ~/.bash_profile or ~/.profile, and if so are you modifying the PATHin any of these files?

  • Thank you for the good detective work. Indeed, the problem was some ancient .profile PATH manipulation functions. Once fixed, all is well. – Tom Loredo Mar 29 '18 at 22:18
1

So I'll try and give this one the ol college attempt. So after messing around with this for about an hour I came to the conclusion that path_helper - the native app that constructs a PATH environment variable from /etc/paths and /etc/paths.d doesn't play well with paths that have spaces in them, ie. thus why you're experiencing your current situation.

So my hacky solution to get this working, is to create a symlink from,

/Applications/VMware Fusion.app

to

/Applications/VMwareFusion.app

using the below command,

ln -sf /Applications/Vmware Fusion.app /Applications/VmwareFusion.app

Then edit /etc/paths.d/com.vmware.fusion.public and change the one line in that file to look like the below,

/Applications/VMwareFusion.app/Contents/Public/

Then obviously start a new shell session or reinit.

This solution works great for me using the fish shell.

💩

  • 2
    Thanks for your input, but the comment by @user3439894 was right. On one of my machines, I had a .profile in place that used some PATH manipulation commands that I cribbed from Fink and elsewhere long ago. It was one of those commands that was at fault. Replacing it made all well, even though there are spaces in the paths in PATH. So path_helper was not at fault; at least in my case, it is correctly handling spaces in paths. – Tom Loredo Mar 28 '18 at 17:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .