{"action":"created","issue":{"url":"https://api.github.com/repos/caskroom/homebrew-cask/issues/13201","labels_url":"https://api.github.com/repos/caskroom/homebrew-cask/issues/13201/labels{/name}","comments_url":"https://api.github.com/repos/caskroom/homebrew-cask/issues/13201/comments","events_url":"https://api.github.com/repos/caskroom/homebrew-cask/issues/13201/events","html_url":"https://github.com/caskroom/homebrew-cask/issues/13201","id":100524296,"number":13201,"title":"Changes to homebrew-cask installation behaviour","user":{"login":"vitorgalvao","id":1699443,"avatar_url":"https://avatars.githubusercontent.com/u/1699443?v=3","gravatar_id":"","url":"https://api.github.com/users/vitorgalvao","html_url":"https://github.com/vitorgalvao","followers_url":"https://api.github.com/users/vitorgalvao/followers","following_url":"https://api.github.com/users/vitorgalvao/following{/other_user}","gists_url":"https://api.github.com/users/vitorgalvao/gists{/gist_id}","starred_url":"https://api.github.com/users/vitorgalvao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vitorgalvao/subscriptions","organizations_url":"https://api.github.com/users/vitorgalvao/orgs","repos_url":"https://api.github.com/users/vitorgalvao/repos","events_url":"https://api.github.com/users/vitorgalvao/events{/privacy}","received_events_url":"https://api.github.com/users/vitorgalvao/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/caskroom/homebrew-cask/labels/meta","name":"meta","color":"d9ede2"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":66,"created_at":"2015-08-12T11:43:43Z","updated_at":"2015-10-06T20:27:34Z","closed_at":null,"body":"# Changes to homebrew-cask installation behaviour\r\n\r\nDepending on how long you’ve been following the development of homebrew-cask (henceforth HBC), you might’ve come across [this great rant](https://github.com/caskroom/homebrew-cask/pull/259#issuecomment-17450940)<sup>1</sup>. It was the turning point in making the `link` stanza (precursor to `app`) a requirement to every cask. Prior to that, HBC tried hard to be smart about what to link, but we eventually concluded being smart doesn’t work — there are too many edge cases.\r\n\r\n#### The end of linking, and the beginning of moving (reasoning)\r\n\r\nWe reached another such point with linking. What works for CLI apps does not work for GUI apps, and by sticking close to the homebrew model we’re bending apps to do what they’re not expecting, and only suffering from it. [Issues we cannot fix](https://github.com/caskroom/homebrew-cask/issues/12517) continue to pop up, and [copy](https://github.com/caskroom/homebrew-cask/issues/3888) as merely a preference or something to be done occasionally can’t solve them. We cannot, in addition to the inconsistency with `pkg`s being installed instead of linked, add yet one extra inconsistency where even `app`s won’t have a predictable behaviour. To put it bluntly, linking sucks for GUI apps. It doesn’t work and will never not be broken, as we can’t control what other developers do.\r\n\r\nLinking isn’t even needed, if you think about it. What separation of concerns are we worried about? CLI tools should have the separation homebrew provides because some of their apps (like newer versions of OS-level tools) provide critical features that could break the entire system if overridden. That is not the case at all with GUI apps; the only apps we have that could break the system on install (`pkg`s) are already given free range. If you use HBC, there’s not even any reason to install a GUI app any other way, so why would that separation matter?\r\n\r\nGUI apps aren’t the only suffering from the current behaviour, even. [Other artifacts](https://github.com/caskroom/homebrew-cask/blob/master/doc/CASK_LANGUAGE_REFERENCE.md#at-least-one-artifact-stanza-is-also-required) suffer from similar issues and [some even required the introduction of a different kind of linking](https://github.com/caskroom/homebrew-cask/pull/2258/files).\r\n\r\nIn addition, while having different versions of the same CLI app is many times desirable, that is a far from the norm with GUI apps. Having an `upgrade` that works on every app, even ones that auto-update, also becomes nonsensical.\r\n\r\nWe should emulate regular usage (i.e. what people do without HBC), instead of trying to perpetuate a new paradigm that is basically contradicting expectations. This, however, does not mean losing customisation options when it makes sense (like `--appdir`).\r\n\r\nEvery workaround we build is forcing apps to fit our model, and our model is bad. We’re building workaround on top of workaround, adding more code and work for something that will never work correctly.\r\n\r\nFrom [The Cathedral and the Bazaar](https://en.wikipedia.org/wiki/The_Cathedral_and_the_Bazaar): “you often don't really understand the problem until after the first time you implement a solution. The second time, maybe you know enough to do it right. So if you want to get it right, be ready to start over at least once”.\r\n\r\nAs with other changes in the past, we now understand this problem a bit better and will adjust our solution accordingly.\r\n\r\n#### The end of linking, and the beginning of moving (technical)\r\n\r\nFirst steps towards new behaviour:\r\n\r\n0. Every artifact stanza except `binary` will move its target to the appropriate location, instead of being sym/hardlinked.\r\n0. `app`s will be moved to `/Applications` by default.\r\n0. `:target` will continue to work, but rename the artifact itself instead of a link.\r\n0. The Caskroom (`/opt/homebrew-cask/Caskroom/` by default) still needs to exist.\r\n0. Versioned subdirectories of the Caskroom won’t exist anymore, though.\r\n\r\nExplanations:\r\n\r\n0. Explained in the **reasonings** above why most artifacts will be moved instead of linked. As for binaries being the exception, it’s simple: not only is it expected, it’s advantageous, recommended, and sometimes necessary. Many times a `binary` is linked from inside an app bundle and cannot simply be moved/copied from there and continue to work. In these cases, symlinking is the recommended (by the developer) course of action anyway, so we stay in line with the idea of emulating regular usage. It also makes it work similarly to other CLI tools, like installs from homebrew.\r\n0. Self-explanatory. It’s what most users expect, and [would be our default anyway](https://github.com/caskroom/homebrew-cask/pull/9178).\r\n0. Self-explanatory.\r\n0. It will be needed to keep a few things:\r\n    1. The originals from `binary`, when they’re standalone.\r\n    2. Other things like [uninstall scripts that come with some `pkg`s](https://github.com/caskroom/homebrew-cask/blob/ef32280fa0208a281101b00a7c26eff7eb8c8c6d/Casks/virtualbox.rb#L15).\r\n0. Explained in the **reasonings** above.\r\n\r\n#### New stanzas/keys/flags to enhance these changes\r\n\r\n0. `auto_updates`. Similarly to [`stage_only`](https://github.com/caskroom/homebrew-cask/blob/80458dfcdc4a19fe6582cf7022b56eb4575c32a0/Casks/consul-web-ui.rb#L11), it should be used when a value of `true` is needed. It means “the artifact this cask uses auto-updates, so even if the cask file updates, leave this alone when upgrading others”. This does not mean `upgrade` in general is no longer a desirable feature — it is, but for casks who do not do it themselves.\r\n0. `:required_location`. Example: `app 'FontForge.app', :required_location => '/Applications'`. It means the artifact needs to be in a certain location to function correctly and as such will be moved there even if you have a different default location.\r\n0. `--force-appdir`. Takes no arguments and forcibly overrides `required_location`.\r\n\r\nPseudo-code for `:required_location`, considering an `app`:\r\n\r\n```\r\nif (--appdir is unset)\r\n  move_to /Applications\r\nelse\r\n  if (cask has :require_location) and (required_location_target != wherever_appdir_is_set_to)\r\n    print_warning \"This app only works if installed in required_location_target, so it will be moved there\"\r\n    move_to required_location_target\r\n  else\r\n    move_to wherever_appdir_is_set_to\r\nend\r\n```\r\n\r\n#### Doesn’t this mean a bunch of stuff might break?\r\n\r\nIn the short term, yes, it does, but it is the right decision. We understand we have a bunch of users that are using homebrew-cask daily, and ideally we could try to make this a smooth transition like in the past. However, we’re admittedly pre-alpha and setting transition strategies is an inglorious job (everything will be discarded in the end, after all) that puts on hold [even the smallest of changes](https://github.com/caskroom/homebrew-cask/pull/9178) indefinitely. It is incredibly time consuming, has variable results (we still get a bunch of issues pertaining to it), and (above all) kills momentum. Furthermore, this is a big change and there’s really no good way to make this seamlessly.\r\n\r\nIn the end, we want to continue to move forward and improve HBC. Being afraid of changes in a pre-alpha would mean stagnation.\r\n\r\n#### Are there any other big changes planned?\r\n\r\nThere are ideas, yes, but no exact plans yet. Those ideas still need to be discussed and most are concerned with the creation and maintenance of casks, not the usage of HBC.\r\n\r\n---\r\n\r\n<sup>1</sup> If you haven’t, I highly recommend it as piece of HBC’s history."},"comment":{"url":"https://api.github.com/repos/caskroom/homebrew-cask/issues/comments/145990120","html_url":"https://github.com/caskroom/homebrew-cask/issues/13201#issuecomment-145990120","issue_url":"https://api.github.com/repos/caskroom/homebrew-cask/issues/13201","id":145990120,"user":{"login":"kevinSuttle","id":95672,"avatar_url":"https://avatars.githubusercontent.com/u/95672?v=3","gravatar_id":"","url":"https://api.github.com/users/kevinSuttle","html_url":"https://github.com/kevinSuttle","followers_url":"https://api.github.com/users/kevinSuttle/followers","following_url":"https://api.github.com/users/kevinSuttle/following{/other_user}","gists_url":"https://api.github.com/users/kevinSuttle/gists{/gist_id}","starred_url":"https://api.github.com/users/kevinSuttle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevinSuttle/subscriptions","organizations_url":"https://api.github.com/users/kevinSuttle/orgs","repos_url":"https://api.github.com/users/kevinSuttle/repos","events_url":"https://api.github.com/users/kevinSuttle/events{/privacy}","received_events_url":"https://api.github.com/users/kevinSuttle/received_events","type":"User","site_admin":false},"created_at":"2015-10-06T20:27:34Z","updated_at":"2015-10-06T20:27:34Z","body":"I'm telling you it's happening on my system. Clean install of El Capitan. "}}