Open prophile opened 4 months ago
I realise the symlink is needed to find the bundle; so in case an alternative is of any use so you could copy into /usr/local/bin/code
rather than symlinking:
% osascript -e 'POSIX path of (path to application id "com.microsoft.VSCodeInsiders")'
/Applications/Visual Studio Code - Insiders.app/
Alternatively, /private
will reliably be at the start of the path if App Translocation is in effect, so you could raise an error or warning when the user tries to run "Install code
command into PATH" which would at least make the situation clearer.
I think I triggered this issue by double clicking on the Application in the disk image (And eventually ejecting the disk image)
Looks like to be fixed, at least installing the Homebrew way.
Does this issue occur when all extensions are disabled?: Yes
Steps to Reproduce:
/Applications
in a manner which triggers App Translocation, such as installing from Homebrew.code
(orcode-insiders
) command into PATHcode
(orcode-insiders
) from the command lineThe workaround to fix this locally is to (I realise this is stupid, but it causes App Translocation not to run on the current OS version) drag the application in Finder.app from /Applications somewhere else, such as the desktop, then drag it back, then rerun "Install
code
command into PATH".App Translocation is a macOS security feature which under a frustratingly nondeterministic set of circumstances causes the application to be copied into a temporary directory and then run from there. In this case the downstream effect is that
/usr/local/bin/code
is installed as a symlink not to/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code
but rather to/private/var/folders/<randomly generated nonsense>/AppTranslocation/<more nonsense>/Visual Studio Code.app/Resources/app/bin/code
.The temporary directory for the translocated app is temporary, so once the app exits or the system reboots, the path no longer exists, leaving
/usr/local/bin/code
as a broken symlink.The workaround I've used right now is to manually move the app around in a way to not cause App Translocation to fire, but this is brittle.