How can one use /etc/paths.d to add a path with spaces in it to $PATH?
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 PATH
in any of these files?
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.