'Docker stopped working: Failed to install symlinks in /usr/local/bin (stage 4)

All of a sudden today Docker on my Mac stopped working with a 'failed to install symlinks"

I tried to get back to a clean state by uninstalling Docker and trying to remove all symlinks in the /usr/local/bin. I'm left with two simlinks docker-compose and docker-machine that I cannot remove even with sudo.

Any suggestion on how to delete those files (that I suspect are the root of the problem) so I can do a clean install?

Not sure if helps but 'Macfee Endpoint security' is running on my Mac.



Solution 1:[1]

I recently have the same problem on my mac.

I resolved it by changing the owner of /usr/local/bin by the current user like that:

# sudo chown -R $(whoami) /usr/local/bin

Solution 2:[2]

This is possibly a broken symlink. Please use this command to find if it’s pointing to an existing parent file:

# ls -lh file

From the output of the command above, if it points to broken parent file, then force the removal of that file first as root:

# rm -rf <broken-referenced-file>

And then unlink the binary symlinks:

# unlink <file>

Also make sure there is no running process related to docker and that no open files are being held by any docker associated process. To get a list of open files do this:

# lsof | grep deleted
# lsof | grep -i docker 
# lsof | grep deleted | grep -i docker

Compare the outputs to see if there are any for docker; if so, kill the process using:

# kill -SIGKILL <PID>

And again try unlinking.

Solution 3:[3]

I ran into this exact same problem this morning ... but instead of jumping straight into file deletion I restarted my mac and all is well again.

Just saying that more often than not a reboot can fix many problems.

Solution 4:[4]

I had the same issue. I find bin some what messed in /usr/local/bin. I took a backup of /usr/local/bin and deleted it and recreate new directory /usr/local/bin with same permissions. Then it worked.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Geoffroy
Solution 2 Gaby Weiss
Solution 3 Nora Heuer
Solution 4 gseenu