Homebrew Cask, Error: No such file or directory @ rb_sysopen - /opt/homebrew/Library/Homebrew/shims/shared/charm

2.2k Views Asked by At

Among the Homebrew casks on my Apple Silicon Mac, via brew list --casks, I can see that pycharm-ce (PyCharm CE) is listed.

However, the application no longer exists at /Applications/PyCharm CE.app, probably after a previously failed update attempt via Homebrew cask.

If I attempt any of the following:

  • brew reinstall --cask pycharm-ce
  • brew uninstall --cask pycharm-ce

I get an No such file or directory @ rb_sysopen error like:

==> Uninstalling Cask pycharm-ce
Error: No such file or directory @ rb_sysopen - /opt/homebrew/Library/Homebrew/shims/shared/charm

If I attempt to download and install the PyCharm .dmg manually from their website, and then attempt to uninstall cask:

  • brew uninstall --zap pycharm-ce

I get the same No such file or directory @ rb_sysopen error, after it has removed the .app:

brew uninstall --zap pycharm-ce
==> Implied `brew uninstall --cask pycharm-ce`
==> Backing App 'PyCharm CE.app' up to '/opt/homebrew/Caskroom/pycharm-ce/2022.1.3,221.5921.27/PyCharm CE.app'
==> Removing App '/Applications/PyCharm CE.app'
Error: No such file or directory @ rb_sysopen - /opt/homebrew/Library/Homebrew/shims/shared/charm

If I simply run brew install --cask pycharm-ce, Homebrew thinks the application is already installed.

How can I clean up this cask, and reinstall PyCharm CE?

1

There are 1 best solutions below

0
P A N On

I don't know if this is the correct solution – but it worked for me to simply delete the folder which belongs to the problematic install (pycharm-ce) from Caskroom (the location under /opt/ is for Homebrew on Apple Silicon):

cd /opt/homebrew/Caskroom
rm -rf pycharm-ce

Then reinstall it again:

brew install --cask pycharm-ce