The problem
Some time ago, I CD into a program directory and use Homebrew to delete the program. When TRYING to reinstall the program using Brew Install, I reported the error. The same error is reported when executing other commands.
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
Error: The current working director doesn't exist, cannot proceed.
Copy the code
The solution
This error is caused by the current execution of the command is in the directory and other processes or environment deleted, CD to the normal directory or re-mkdir current directory.