I am quite often in areas where the WIFI connection is unreliable and slow, but occasionally I would like to upgrade a package from homebrew.
Unfortunately if a binary download fails, it will attempt to install from source, which will in most cases cause it to download even more dependencies, actually making the situation worse.
Is there a way to inhibit building from source? I would prefer to just let it fail and retry later when I have a better connection.
You can use:
brew install --force-bottle myformula
According to the brew man page:
If --force-bottle is passed, install from a bottle if it exists for the current or newest version of macOS, even if it would not
normally be used for installation.
Related
I brew install --HEAD'd node recently to see if the upstream version fixed a bug I was experiencing. (It did!)
Now I'd like to downgrade back to the stable, bottled version. Is there a simple command to do so?
brew reinstall simply pulls & rebuilds the HEAD version from upstream. (Where does Homebrew "remember" my HEAD preference?)
brew uninstall --ignore-dependencies && brew install is of course possible, but annoying given that it would also delete my build history & install receipts, which I'd like to keep around a bit if possible.
I did the same thing for pyenv while waiting for version 2.1.0 to make it into homebrew-core. I figured I'd simply uninstall pyenv and reinstall it without --HEAD, but when I attempted to do so, Homebrew told me:
Only uninstalling HEAD version because multiple versions are installed
(Or something like that.)
The documentation doesn't really explain this, as far as I can tell, but I did find an explanation here:
uninstall first removes whichever version is "active", i.e. linked into the main prefix. What happens when you run uninstall again depends on how many other versions are installed: if there is only one, it is removed, otherwise it errors out because it doesn't know which one to uninstall (unless you pass --force).
So I didn't need to do anything else, aside from delete the pyenv repository that Homebrew cloned under ~/Library/Caches/Homebrew/pyenv--git. (I think the fact that it doesn't remove this might be a bug.)
Now, if you first uninstalled node stable, then installed HEAD, your situation might be different.
(I know this might not be a great answer, but it's too long for a comment.)
apt-get method: I'm trying to install LLVM and Clang on Ubuntu 15.10. I used the commands sudo apt-get install llvm and sudo apt-get install clang. This seemed to have worked, and it only took a few minutes.
Manual method: However, most instructions online have me manually download and build the LLVM and Clang packages (e.g. see here: http://clang.llvm.org/get_started.html). I understand this method could take some time, even a few hours for building LLVM and Clang.
What's the difference between these two methods? Are they equivalent? I just want to make sure I have everything installed correctly. (My background is in Windows, so I'm missing the probably obvious difference.)
apt-get installs already compiled packages from the repository of the distribution. It also takes care of installing all dependencies. The package maintainer has compiled the package and makes sure that it dependencies (other packages and their versions) are met.
This approach is very convenient and should, by all means, be preferred. The only major advantage – or argument in favour – of a source installation is that you get more recent packages.
Compiling from source may be necessary when you want to benefit from features that are not yet available in the distribution’s version. In the case of the compiler it may also be that a newer version produces “better” binaries than an earlier version.
Another reason for choosing to compile software yourself may be that you want to influence the building process, e.g. different compiler settings or a different configuration with less dependencies. However, such cases are quite rare – in most case, it isn’t worth the trouble.
Also, as you’ve experienced yourself, installing a pre-compiled package takes only a few minutes (or even just seconds), while compiling will take some time depending on the software to compile and your hardware.
Bottom line, unless you have a good reason, use the distribution’s package(s).
I want to switch to Homebrew instead of MacPorts because Homebrew told me to (http://cl.ly/image/1b0M0q2x1C3K) and it seems better.
I'm a bit weary about how to uninstall MacPorts since it's installed trough Terminal and not trough .app as a regular OS X program.
How do I uninstall?
sudo port -f uninstall installed
will uninstall all ports.
Then read the guide for cleaning up the leftover bits.
https://guide.macports.org/chunked/installing.macports.uninstalling.html
You can use brew along with macports without any issues as brew installs the packages under a different directory.
I have been using both of these package managers without any problems.
Macports and Brew are better in their own way, you never know when you might want to use macports, it is going to get better and faster.
I tend to use both depending on what I want to install and do further.
If you still insist on uninstalling MacPorts, you can follow the steps as mentioned by Kirk Roybal.
I know this is an old post.
But for clarity: brew installs to /usr/local. macports installs to /opt/local. When you have duplicates (binaries, objects, libraries) and/or version difference (i.e. duplicates that have the same name but are different versions), then you can have issues if you do not manage it. Manage it through your command search rules (PATH in bash,csh for example) and your library search rules if applicable. If you have a collision that can't be resolved this way or you don't want to deal with it, then you have to pick one - i.e. delete the one you don't want and replace it with a link to the one to keep. I've used both MacPorts and Brew for a long time successfully.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I've just recently switched to a Mac from Ubuntu. I was disappointed that mac doesn't have the convenient sudo apt-get in Ubuntu. I've heard that I should use homebrew but I'm not exactly sure what homebrew or macports does?
MacPorts is the way to go.
Like #user475443 pointed, MacPorts has many many more packages. With brew you'll find yourself trapped soon because the formula you need doesn't exist.
MacPorts is a native application: C + TCL. You don't need Ruby at all. To install Ruby on Mac OS X you might need MacPorts, so just go with MacPorts and you'll be happy.
MacPorts is really stable, in 8 years I never had a problem with it, and my entire Unix ecosystem relay on it.
If you are a PHP developer you can install the last version of Apache (Mac OS X uses 2.2), PHP and all the extensions you need, then upgrade all with one command. Forget to do the same with Homebrew.
MacPorts support groups.
foo#macpro:~/ port select --summary
Name Selected Options
==== ======== =======
db none db46 none
gcc none gcc42 llvm-gcc42 mp-gcc48 none
llvm none mp-llvm-3.3 none
mysql mysql56 mysql56 none
php php55 php55 php56 none
postgresql postgresql94 postgresql93 postgresql94 none
python none python24 python25-apple python26-apple python27 python27-apple none
If you have both PHP55 and PHP56 installed (with many different extensions), you can swap between them with just one command. All the relative extensions are part of the group and they will be activated within the chosen group: php55 or php56. I'm not sure Homebrew has this feature.
Rubists like to rewrite everything in Ruby, because the only thing they are at ease is Ruby itself.
Homebrew and macports both solve the same problem - that is the installation of common libraries and utilities that are not bundled with osx.
Typically these are development related libraries and the most common use of these tools is for developers working on osx.
They both need the xcode command line tools installed (which you can download separately from https://developer.apple.com/), and for some specific packages you will need the entire xcode IDE installed.
xcode can be installed from the mac app store, its a free download but it takes a while since its around 5GB (if I remember correctly).
macports is an osx version of the port utility from BSD (as osx is derived from BSD, this was a natural choice). For anyone familiar with any of the BSD distributions, macports will feel right at home.
One major difference between homebrew and macports; and the reason I prefer homebrew is that it will not overwrite things that should be installed "natively" in osx. This means that if there is a native package available, homebrew will notify you instead of overwriting it and causing problems further down the line. It also installs libraries in the user space (thus, you don't need to use "sudo" to install things). This helps when getting rid of libraries as well since everything is in a path accessible to you.
homebrew also enjoys a more active user community and its packages (called formulas) are updated quite often.
macports does not overwrite native OSX packages - it supplies its own
version - This is the main reason I prefer macports over home-brew, you
need to be certain of what you are using and Apple's change at
different times to the ports and have been know to be years behind
updates in some projects
Can you give a reference showing that macports overwrites native OS X
packages? As far as I can tell, all macports installation happens in
/opt/local
Perhaps I should clarify - I did not say anywhere in my answer that macports overwrites OSX native packages. They both install items separately.
Homebrew will warn you when you should install things "natively" (using the library/tool's preferred installer) for better compatibility. This is what I meant. It will also use as many of the local libraries that are available in OS X. From the wiki:
We really don’t like dupes in Homebrew/homebrew
However, we do like dupes in the tap!
Stuff that comes with OS X or is a library that is provided by
RubyGems, CPAN or PyPi should not be duped. There are good reasons for
this:
Duplicate libraries regularly break builds
Subtle bugs emerge with duplicate libraries, and to a lesser extent, duplicate tools
We want you to try harder to make your formula work with what OS X comes with
You can optionally overwrite the macosx supplied versions of utilities with homebrew.
Currently, Macports has many more packages (~18.6 K) than there are Homebrew formulae (~3.1K), owing to its maturity. Homebrew is slowly catching up though.
Macport packages tend to be maintained by a single person.
Macports can keep multiple versions of packages around, and you can enable or disable them to test things out. Sometimes this list can get corrupted and you have to manually edit it to get things back in order, although this is not too hard.
Both package managers will ask to be regularly updated. This can take some time.
Note: you can have both package managers on your system! It is not one or the other. Brew might complain but Macports won't.
Also, if you are dealing with python or ruby packages, use a virtual environment wherever possible.
By default, Homebrew installs packages to your /usr/local. Macport commands require sudo to install and upgrade (similar to apt-get in Ubuntu).
For more detail:
This site suggests using Hombrew: http://deephill.com/macports-vs-homebrew/
whereas this site lists the advantages of using Macports: http://arstechnica.com/civis/viewtopic.php?f=19&t=1207907
I also switched from Ubuntu recently, and I enjoy using homebrew (it's simple and easy to use!), but if you feel attached to using sudo, Macports might be the better way to go!
One of the reasons I'm still using macports is that it is easy to switch between versions of things you download. For example, if I want to change my GCC version to 4.8 all I have to do is
sudo port set --select gcc mp-gcc48
No mucking around in environmental variables. I see that there are multiple versions of gcc to be got from homebrew, but is there an easy way to activate and deactivate versions of things? I didn't notice anything in the documentation.
Option 1 is that you install multiple versioned packages in parallel. Then you'd call gcc-4.7 or gcc-4.8, etc.
Option 2 is to selectively brew link and brew unlink the package versions that you prefer to use. Note that an "unlinked" package is still installed and usable from /usr/local/opt/<package>/, it's just not in the default path.
Which one you use depends on how the individual packages are set up and how often you need to switch around. It's perhaps not quite as clear-cut as with MacPorts, but it works just fine.