How to migrate to the new location? #21913

Closed
mattfelsen opened this Issue Jun 13, 2016 · 15 comments

Projects

None yet
@mattfelsen
Contributor

Good morning! Since the location change and #21901, I'm now seeing the warning about migrating Casks, as expected. I've searched around a bit but don't understand what I need to do as an end-user. Is there a command for migrating? Is it simply a move of the /opt/homebrew-cask/Caskroom/ directory to /usr/local/Caskroom/? A bit more info would be helpful as I don't want to muck anything up. Thanks!

@jawshooah
Member

Yes, the simplest thing would be to mv /opt/homebrew-cask/Caskroom /usr/local. However, any casks installed prior to #13966 were symlinked rather than moved to their destinations, so you'll need to re-install those manually.

If we do wind up phasing out --caskroom, it won't be for a while, so you have plenty of time to find old casks and brew cask install --force them.

@vitorgalvao
Member

Closing the issue as it has been answered, but making it the default to answer the questions that arise.

If new questions come up, we should edit @jawshooah’s comment to make it clearer.

@tehmaspc
Contributor

I just re-installed one of my Caskroom apps and noticed that it was still installed to /opt/homebrew-cask/Caskroom? Doesn't seem like homebrew-cask is properly defaulting? I don't have any HOMEBREW_CASK_OPTS options set.

@msridhar
Contributor

@tehmaspc same for me; it was the eclipse-java app. Re-installing other apps hasn't had the same problem thus far.

@tehmaspc
Contributor
tehmaspc commented Jun 13, 2016 edited

Ah. I tested my sonos app. So there are individual casks that must be expecting /opt/homebrew-cask/Caskroom then or something. For now I'm going to set HOMEBREW_CASK_OPTS :).

@jawshooah
Member

#21901 changed the behavior to default to the old location if it still exists and print a warning about the new default, to mitigate the issues brought about by the original change. No need to change HOMEBREW_CASK_OPTS if you delete /opt/homebrew-cask/Caskroom.

@grootknol
Contributor

After receiving the warning, I've moved my Caskroom to /usr/local/Caskroom. Now brew cask list lists the installed casks but brew cask uninstall can't remove them.

➜  Casks git:(master) brew cask list
hazel                   textmate
iterm2                  the-unarchiver
java                    transmission
jettison (!)                vagrant
macports                virtual box
mplayerx                virtualbox-extension-pack
source tree             vlc
stremio
➜  Casks git:(master) brew cask uninstall hazel
Error: hazel is not installed
➜  Casks git:(master) brew cask uninstall mplayerx
Error: mplayerx is not installed
@madsem
madsem commented Jun 14, 2016

@grootknol you have to brew cask install APP_NAME --force

@jawshooah
Member

@grootknol This is a result of a known issue with brew cask list (#14058). You have to brew cask uninstall --force mplayerx

@chrisfinazzo
Contributor

Good to know, I just hit this. Currently have no Casks installed, but will open a PR when BBEdit 11.6 gets released. Assuming that @jawshooah is correct in how this should be handled, is it worth adding a line to the output of brew cask list just to tell people 'here's what you need to do?'

@grootknol
Contributor

Could I just do for cask in $(brew cask list) do; brew cask install $cask --force; after moving Caskroom to the new directory?

@zanderzhng
Contributor

for me I did find /usr/local/Caskroom -name "*.app" -maxdepth 3 -exec mv {} ~/Applications \; after moving cask room and removing all the alias.

@herrbischoff
Contributor

@grootknol: Even simpler... brew cask install --force $(brew cask list)

@n8henrie
Contributor
n8henrie commented Jun 15, 2016 edited

I had a ton of Casks that were still symlinked from ~/Applications to /opt/homebrew-cask/Caskroom, so I first moved my Caskroom using the command above mv /opt/homebrew-cask/Caskroom /usr/local then changed all the symlinks to match the new location:

for f in ~/Applications/*.app; do oldloc="$(readlink "$f")"; [[ -e $oldloc ]] || ln -sf "/usr/local${oldloc#/opt/homebrew-cask}" "$f"; done

Seems to have worked.

@jawshooah
Member

The solutions presented in this thread should work equally well for other symlinked artifacts, so I'm locking it. Feel free to open a new issue if you have trouble.

@jawshooah jawshooah locked and limited conversation to collaborators Jun 15, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.