brunophilipe / Cakebrew

Manage your Homebrew formulas with style using Cakebrew.
http://www.cakebrew.com
GNU General Public License v3.0
4.8k stars 254 forks source link

Install homebrew if not installed #89

Open chbrown opened 9 years ago

chbrown commented 9 years ago

Obviously, this is already on the Cakebrew To-do list, but it'd be a killer feature to have.

"Afraid to use the terminal but need that small program or tool?" describes my clientele and use-case perfectly, for whom even ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" might be a bit much to ask.

Maybe a separate window on the Cakebrew app for basic homebrew installation, filled with disclaimers, that can shell out to that ruby command? I'm pretty sure all post-Lion OS X's will come with ruby and curl.

xhruso00 commented 9 years ago

If it is a click of a button that would install Homebrew I would be more than happy.

Homebrew requirements: 1) Xcode or command line tools for xcode 2) User input in certain cases during homebrew installation

Only solution I see is single button that can open terminal and a single button to download command line tools for xcode. What do you think?

brunophilipe commented 9 years ago

Command line tools installation prompt is displayed whenever the user tries to use a developer tool such as git or gcc, but it requires the admin password. Also, the Homebrew installation can have some hiccups, as I have already seen happening with some friends' machines. What would be done about them?

brunophilipe commented 9 years ago

I am going to start working on this. I'll try setting up a VM in a way that I can revert the Homebrew installation so this can be tested thoroughly.

brunophilipe commented 9 years ago

Ok, I've experimented with this, and so far it can't be done just by running the brew install script like we do with the brew tasks. The installer requires a TTY-enabled interface to use sudo, which can't be simulated using NSTask at all.

screen shot 2015-05-23 at 4 12 13 pm

Enabling it via ask-pass sounds very complicated as well.

My latest tests are on the install-homebrew branch.

chriskilding commented 8 years ago

Here's an alternative approach (very much WIP) as food for thought...

It seems comparatively simple to ship a single fat binary with a Mac application (well, compared to shipping code + an interpreter + trying to keep that lot updated). Thus far, it seems that people have only considered shipping the Homebrew utility as is, in its interpreted form.

However, I was playing with RubyMotion recently and thought there could be another way. If it were possible to compile Homebrew with RubyMotion into a single fat binary - which is what I have been looking at - I guess the Cakebrew crew could just stick it in the Cakebrew Application Support directory, and boom, it's done.

For bonus points - assuming the above worked - I guess someone could write a little script to add the Cakebrew Application Support dir to the user's PATH so that brew can be invoked in the terminal.

Work in progress can be seen at https://github.com/themasterchef/homebrew - it doesn't yet compile because Homebrew uses a few Ruby features which RubyMotion doesn't support, sometimes on principle (like runtime requires scattered throughout method bodies to load more code - yuck!). But it seems somewhat viable that those features could be replaced in the Homebrew app code, without having to touch the Formulae. I have listed some of the things we might need to replace in the 'Rubymotion learnings' section of the README.

danielbair commented 8 years ago

If you would like to try another way, I have two bash scripts. The first one 'homebrew_install.sh' uses AppleScript to open the Terminal and execute the second script 'install_homebrew.sh', which does the homebrew install and also updates the environment variables.

So, you could check if homebrew is not installed and call 'homebrew_install.sh' to initiate the installation via Terminal.

HomeBrewInstaller.zip

twardoch commented 7 years ago

If you name a shell script install_homebrew.command instead of install_homebrew.sh and make it executable (chmod gou+x install_homebrew.command) then it will launched when double-clicked.